Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

how to convert decimal to binary in java

+1 vote
asked Feb 1, 2019 by anonymous

1 Answer

0 votes
answered Feb 1, 2019 by anonymous

public void binario(int numero)

int d = numero; StringBuffer binario = new StringBuffer(); // guarda os dados 

while (d > 0) { int b = d % 2

binario.append(b); 

d = d >> 1; // é a divisão que você deseja 

} System.out.println(binario.reverse().toString()); // inverte a ordem e imprime }

commented Feb 4, 2019 by anonymous
hellohellohellohello
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...