Urgent Java Help please
Hey , I'll give you some background on what i have to do first before i get to the problem.
i need to write a java swing programme that converts Decimal numbers into Binary numbers(maximum 8 bit) and then output them in graphical form.
What i am having a problem with is taking the integer from a text box and converting it to binary i'm not allowed to use the "Integer.toBinaryString" method. and then when i have the output i need to split the binarystring into seperate digits ( in a char array) i think and then from the array i need to determine if the digit is a 1 or a 0.
from there i am going to say " if 1 then seticon to 1.jpg" which is how i am going to get it to output in graphical form.
Can anyone help?
Summary of what i'm Stick with :
Spliting an integer into digits
Converting decimal to binary without Integer.toBinaryString.
Thank you very much , Scott
splitting an integer into digits: look at playing with mod arithmetic and integer division, and you'll find your solution.
Converting decimal to binary: work it out on paper, the algorithm requires nothing more than basic algebra, then once you've done that it's trivial to translate it into java.
come on back with your results of the above and we can help you some.