I want to store the number of 1's in the binary representation of some integers given in an array in another corresponding array; following is the code I am writing; but it shows the error "Change type of 'arr' to 'int'" What's going wrong?
public static int[] arrange(int[] numbers){
String[] arr = new String[numbers.length];
for(int i =0;i<numbers.length;i++){
arr[i]= Integer.toBinaryString(numbers[i]);
}
int[] a2 = new int[numbers.length];
for(int i =0;i<numbers.length;i++){
a2[i]=Integer.bitCount(arr[i]);
}