Here you can find the source of getPrivateKeyBytes(BigInteger privateKey)
public static byte[] getPrivateKeyBytes(BigInteger privateKey)
//package com.java2s; //License from project: Apache License import java.math.BigInteger; public class Main { public static byte[] getPrivateKeyBytes(BigInteger privateKey) { byte[] privateKeyPlainNumber = privateKey.toByteArray(); int plainNumbersOffs = privateKeyPlainNumber[0] == 0 ? 1 : 0; byte[] privateKeyBytes = new byte[32]; System.arraycopy(privateKeyPlainNumber, plainNumbersOffs, privateKeyBytes, privateKeyBytes.length - (privateKeyPlainNumber.length - plainNumbersOffs), privateKeyPlainNumber.length - plainNumbersOffs); return privateKeyBytes; }// w w w .j a va 2 s. com }