This week's book giveaway is in the JavaScript forum.We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
programming forums Java Java JSRs Mobile Certification Databases Caching Books Engineering Languages Frameworks Products This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Sheriffs:
Saloon Keepers:
Bartenders:

# toXxxString() explain me logic

Ami Ambre
Ranch Hand
Posts: 58
I have not understand properly with this link

Integer & Long wrapper classes convert numbers in base 10 to other bases.
Conversion methods, toXxxString() take an int or long & return a
String representation of the Converted number, for e.g
String s1=Integer.toHexString(254);//convert 254 to hex

System.out.println("254 is" + s1);//"254 is fe"

String s2=Integer.toOctalString(254);//convert 254 to octal

System.out.println("254 (oct) =" + s1);//"254 (oct)=376"

Keith Nagle
Ranch Hand
Posts: 65
Hello.
You will probably need to rethink your post
and clarify exactly what you do not understand...
Regards

Mamta Sharma
Greenhorn
Posts: 25
Hi there,
you have provided the code:-
String s1=Integer.toHexString(254);//convert 254 to hex

System.out.println("254 is" + s1);//"254 is fe"

String s2=Integer.toOctalString(254);//convert 254 to octal

System.out.println("254 (oct) =" + s2);//"254 (oct)=376"
Everything is fine with this code, 254 is fe(1514)in hexadecimal & 376 in octal representation.
Do you still have any doubt??
[ July 09, 2008: Message edited by: Mamta Sharma ]
[ July 09, 2008: Message edited by: Mamta Sharma ]

 It is sorta covered in the JavaRanch Style Guide.