I've been searching for all codes in the internet, but all I see is for Buffered Reader. Is it possible to have it in a JFrame format? I am new to Java and I wanted to create this program which will convert a decimal number to binary and vice versa. Can you help me how to do it?
Converting and rendering (displaying) are completely unrelated issues.
To convert, use Integer.parseInt()
and Integer.toBinaryString()
:
String input = "10"; // some number as your input
int i = Integer.parseInt(input);
String binary = Integer.toBinaryString(i);
To display, put that String into the display area (too trivial to bother with here)