Results 1 to 2 of 2
  1. #1
    trosity is offline Member
    Join Date
    Mar 2009
    Posts
    1
    Rep Power
    0

    Default 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

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    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.

Similar Threads

  1. urgent:calling c program from java
    By rach in forum New To Java
    Replies: 6
    Last Post: 01-19-2010, 11:37 AM
  2. Java Beginner needs urgent help!
    By Polyy in forum New To Java
    Replies: 3
    Last Post: 11-24-2008, 03:11 AM
  3. Java mail problem Urgent
    By sundarjothi in forum Advanced Java
    Replies: 0
    Last Post: 06-02-2008, 11:34 AM
  4. Urgent Java programmer needed.
    By KevinG in forum Jobs Offered
    Replies: 5
    Last Post: 04-23-2008, 04:02 AM
  5. Urgent Requirement for Java/J2ee
    By anushareddy7480 in forum New To Java
    Replies: 0
    Last Post: 07-23-2007, 11:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •