Is this correct? I am trying to set this up as an interview question and need help with the correct answer. If anyone can take a look at the code below and let me know if this is the correct answer, and if there are other correct answers than just the one below that would be great.
The question is "Create a Program That Will Convert Decimal Number into Binary Format" Using JAVA
package com.java2novice.algos;
public class DecToBin {
public void showBinaryFormat(int numbers){
int binaryNo[] = new int[25];
int indexNo = 0;
while(number > 0){
binaryNo[index++] = numbers%2;
numbers = numbers/2;
}
for(int i = indexNo-1;i >= 0;i--){
System.out.print(binaryNo[i]);
}
}
public static void main(String a[]){
DecimalToBinary dtb = new DecimalToBinary();
dtb.showBinaryFormat(25);
}
}