Get byte array from BigInteger in Java
Description
The following code shows how to get byte array from BigInteger.
Example
/*from ww w . ja v a 2s. c om*/
import java.math.BigInteger;
public class Main {
public static void main(String[] argv) throws Exception {
BigInteger bi = new BigInteger("100100100111111110000", 2);
byte[] bytes = bi.toByteArray();
}
}
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »