Convert BigInteger to hexadecimal in Java
Description
The following code shows how to convert BigInteger to hexadecimal.
Example
/*www . ja v a2 s . c om*/
import java.math.BigInteger;
public class Main {
public static void main(String[] argv) throws Exception {
BigInteger bi = new BigInteger("3ff", 16);
String s = bi.toString(16);
System.out.println(s);
}
}
The code above generates the following result.
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »