Parse and format to hexadecimal in Java
Description
The following code shows how to parse and format to hexadecimal.
Example
/*from ww w . j ava2s .co m*/
public class Main {
public static void main(String[] argv) throws Exception {
int i = Integer.parseInt("3ff", 16);
String s = Integer.toString(i, 16);
System.out.println(s);
}
}
The code above generates the following result.
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »