Results 1 to 2 of 2
Thread: Urgent Java Help please
- 03-13-2009, 02:41 AM #1Member
- Join Date
- Mar 2009
- Rep Power
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.
- By rach in forum New To JavaReplies: 6Last Post: 01-19-2010, 12:37 PM
- By Polyy in forum New To JavaReplies: 3Last Post: 11-24-2008, 04:11 AM
- By sundarjothi in forum Advanced JavaReplies: 0Last Post: 06-02-2008, 12:34 PM
- By KevinG in forum Jobs OfferedReplies: 5Last Post: 04-23-2008, 05:02 AM
- By anushareddy7480 in forum New To JavaReplies: 0Last Post: 07-23-2007, 12:56 PM