Hi Friends, I want to know how to give binary value to int. Like how we give for hexa decimal(starting with 0X) and for octal(starting with 0). Is there any convention that has to be followed to give binary value to int.
Originally posted by Ravindranath Chowdary: Hi, I can't able to get the int from the binary with the
convertToBinary("10001000001001"); Can you please clear my doubt.
First, If you read the previous post again, you'll notice that it is Pseudo Code, and that you should look at Integer.parseInt() for more information.
Second, please don't do this... To create a new string object, which is then parsed, just because you want to be able to read binary in the source code is silly. Most developers just get comfortable with reading hexidecimal. (Not to mention that you will probably be challenged at your next code review for doing this)