Convert Byte Array into decimal through BigInteger in Java
Description
The following code shows how to convert Byte Array into decimal through BigInteger.
Example
// w w w . j a va 2 s. c o m
import java.math.BigInteger;
public class Main {
public static void main(String[] argv) throws Exception {
byte[] bytes = new byte[] { (byte) 0x12, (byte) 0x0F, (byte) 0xF0 };
BigInteger bi = new BigInteger(bytes);
// Format to decimal
String s = bi.toString();
}
}
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »