public class PrimateSort { public static void main(String[] args){ int[] array = { 1,1,1,1,1,1,1,0,0,0 }; // Array of 1s and 0s (Not random, but you can switch it up) array = sortIntegers(array); for(int i=0; i<array.length; i++) System.out.println(array[i]); } private static int[] sortIntegers(int[] array){ int num0=0; // Number of 0s int num1=0; // Number of 1s for(int i = 0; i<array.length; i++){ if(array[i]==0) // if the array holds a 0 increment num0 num0++; else // if the array holds a 1 increment num1 num1++; } for(int i = 0; i<num0; i++ ) // Write 0s to the beginning of the Array array[i]=0; for(int i=0; i < num1; i++ ) // Write 1s to the end of the Array array[num0+i] = 1; return array; }}