Trugis , . , .
:
int[][] A = { { 2, 3, 4, 2, 4, 4, 5, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 4, 3, 4, 5, 6 },
{ 2, 0, 4, 2, 0, 4, 1, 2, 3, 4 }};
int N = A.length;
int M = A[0].length;
int firstZeros = 0;
for(int i = 0; i < N; i++) {
for(int j1 = 0; j1 < M; j1++) {
if (A[i][j1] == 0 && firstZeros == j1) {
firstZeros++;
continue;
}
for(int j2 = j1+1; j2 < M; j2++) {
if(A[i][j2] == 0) {
for (int j3 = j2; j3 > firstZeros; j3--) {
A[i][j3] = A[i][j3-1];
A[i][j3-1] = 0;
}
firstZeros++;
}
}
}
firstZeros = 0;
}