I'm doing a java project where I have to convert from binary numbers and decimals. I'm working on converting from decimal to binary right now. This is the bit of code that i have. I don't know how to loop the remainders multiple times in this code.
public static void decimalToBinary() {
Scanner input = new Scanner (System.in);
System.out.println ("Input decimal number");
String decimal = input.next();
int x = Integer.parseInt(decimal);
int remainder = x%2;
char[] charArray = decimal.toCharArray();
}
I don't know how to continue this. Thank you for your answers so far but i want to complete this with an array thats the challegne of the problem.