Skip to content

Commit e6304a4

Browse files
authored
Merge pull request #130 from Akash073-hub/Tasks
Here i did to move all zeros in arrays at end and in sorting way this…
2 parents 45f0936 + 2d75834 commit e6304a4

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed
Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11
package SortingAlgorithams.BubbleSorting;
22

3+
import java.util.Arrays;
4+
35
public class Task3 {
4-
}
6+
static void main() {
7+
int [] arr = {1,0,4,0,0,5,6,7};
8+
int j =0;
9+
for(int i=0;i< arr.length;i++){
10+
if(arr[i] != 0){
11+
int temp = arr[i];
12+
arr[i] = arr[j];
13+
arr[j] = temp;
14+
j++;
15+
}
16+
}
17+
System.out.println(Arrays.toString(arr));
18+
}
19+
}

0 commit comments

Comments
 (0)