Need Some Programming Help

gilad50303

New Member
Hey guys,
I need to make a program that converts numbers from base 10 to 2 in java. Can anyone tell me how to write (what to write would be highly appreciated). I know I need to use arrays but am not sure how to use them or what to do.
Thanks.
 
Do you know how to convert those numbers on paper? An array isn't necessary (well a string is an array but it doesn't really count)
 
Also, check the javadocs for the Integer funtions. Of particular interest is this one ;)

public static String toBinaryString(int i)Returns a string representation of the integer argument as an unsigned integer in base 2.

The unsigned integer value is the argument plus 232 if the argument is negative; otherwise it is equal to the argument. This value is converted to a string of ASCII digits in binary (base 2) with no extra leading 0s. If the unsigned magnitude is zero, it is represented by a single zero character '0' ('\u0030'); otherwise, the first character of the representation of the unsigned magnitude will not be the zero character. The characters '0' ('\u0030') and '1' ('\u0031') are used as binary digits.


Parameters:
i - an integer to be converted to a string.
Returns:
the string representation of the unsigned integer value represented by the argument in binary (base 2).
 
Hey guys,
Thanks for the help. Can any of you try to write at least part of the program? I know how to do it on paper but can not write the actual program.
Thanks!
 
Well, I don't mind helping you with something you are having trouble with but I'm not going to write it for you. Take a stab at it, I'll look it over and point out any spots where you went wrong or that could be done a better way and do my best to explain why.
 
Back
Top