What is the toHexString() method of the Long class?

Are you preparing for IT certification? With practice questions, study notes, interactive quizzes, tips and technical articles, uCertify PrepKits ensure that you get a solid grasp of core technical concepts to ace your certification exam in first attempt.

What is the toHexString() method of the Long class?

Rating:

The toHexString() method converts an integer value into a hexadecimal string. The Long class defines this method with the following signature:

public static String toHexString(long L)

The given signature of the method suggests that it takes a long argument and returns a String object. The String object returned by the method is a string that represents an unsigned integer value in base 16.

The toHexString() method works as follows:

  1. If the argument to the method is a positive value, then the method converts this value to a string of ASCII digits in hexadecimal (i.e., base 16) format with no extra leading zeros.


  2. If the argument to the method is a negative value, the method first converts it to an unsigned integer by adding the value 264 to the value. The value so obtained is then converted to a string of ASCII digits in hexadecimal with no extra leading zeros.


Rating:



Other articles

Click here to Article home

 
uCertify.com | Our Company | Articles | Privacy | Security | Contact Us | News and Press Release | uCertify India
MCSE: MCSA, MCTS, MCITP    JAVA Certification: SCJP, SCWCD Cisco Certification: CCNA, CCENT, A+, Network+, Security+
Oracle Certification: OCP 9i, OCP 10g, OCA 9i, OCA 10g CIW foundation    EC-212-32    CISSP    Photoshop ACE    Adobe Flash ACE
© 2008 uCertify.com. All rights reserved. All trademarks are the property of their respective owners.