import java.util.Arrays;
public class arrayDemo7 {
public static void main(String[] args) {
int[] arrays = {5,2,3,1,4,6};
sortArrays(arrays);
System.out.println(Arrays.toString(arrays));
}
public static int[] sortArrays(int[] arrays){
for (int length = arrays.length; length > 0; length--) {
for (int i = 0; i < arrays.length-1; i++) {
int temp = 0;
if(arrays[i] > arrays[i + 1]){
temp = arrays[i];
arrays[i] = arrays[i + 1];
arrays[i + 1] = temp;
}
}
}
return arrays;
}
}