• Post Reply Bookmark Topic Watch Topic
  • New Topic

toHexString  RSS feed

 
satya narayan reddy
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public class NumberFormats
{
public static void main(String argv[])
{
System.out.println(Integer.toBinaryString(4));
System.out.println(Integer.toHexString(16));

}
}

output:
------
100
10

hi all
how the output for the above program is giving 100 and 10.can anybody
explain me how the output is being generated?
 
Tony Morris
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Quite simply, the base 10 value 16 is equivalent to the base 16 value 10.
You may have been taught since you were a little tacker about the base 10 system without ever knowing about the possibility of other number systems, such as the very common base 2 (binary), base 8 (octal) and base 16 (hexadecimal).

Give google a burl.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you know how binary and hexadecimal number representations work? If not, follow the links.
 
satya narayan reddy
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks mates for your valuable information....

thanks,
satya
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!