Here you can find the source of getKeyFromBigInteger(final BigInteger value, final int numBytes)
protected static byte[] getKeyFromBigInteger(final BigInteger value, final int numBytes)
//package com.java2s; //License from project: Apache License import java.math.BigInteger; public class Main { protected static byte[] getKeyFromBigInteger(final BigInteger value, final int numBytes) { final byte[] valueBytes = value.toByteArray(); final byte[] bytes = new byte[numBytes]; System.arraycopy(valueBytes, 0, bytes, 0, Math.min(valueBytes.length, bytes.length)); return bytes; }// w w w . j a v a 2 s . c o m }