In this section you will learn to
convert the Integer type object to a String object
using the Integer.toBinaryString() and Integer.toHexString() methods.
Here is an example that provides the
usage of the
Integer.toBinaryString()
and Integer.toHexString() method in more detail.
Create a class "NumberFormats" where an
integer type object is converted into a string of binary type using the Integer.toBinaryString()
and again to a hex type string using the Integer.toHexString() type method.
Here is the Code of the Example :
NumberFormats.java:
import java.util.*;
|
Here is the Output of the Example :
| C:\roseindia>javac NumberFormats.java C:\roseindia>java NumberFormats 100 10 C:\roseindia> |
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Convert an Integer type object to a String object
Post your Comment