?
Solved

Is there a hexadecimal data type in Java?

Posted on 2008-11-17
2
Medium Priority
?
326 Views
Last Modified: 2013-12-29
Hi,
  Is there a hexadecimal data type in Java?

Thanks!
0
Comment
Question by:pbenito
2 Comments
 
LVL 6

Accepted Solution

by:
javaexperto earned 1000 total points
ID: 22980732
Of course Integral literals may be represented by decimal, octal, or hexadecimal numbers. The hexadecimal numbers are prefixed with hexadecimal with 0x or 0X. Example:

int x = 0x2b;
int x = 0x2B;
int x = 0X2b;
int x = 0X2B;
0
 
LVL 11

Assisted Solution

by:spoxox
spoxox earned 1000 total points
ID: 22980841
This (from Integer) might be useful...

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


0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses
Course of the Month16 days, 8 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question