Code example for BigInteger

Methods: toByteArray

0
   } 
 
   @Override 
   public byte[] getPrivateKeyBytes() { 
      byte[] result = new byte[32];
      byte[] bytes = _privateKey.toByteArray();
      if (bytes.length <= result.length) {
         System.arraycopy(bytes, 0, result, result.length - bytes.length, bytes.length);
      } else { 
         // This happens if the most significant bit is set and we have an 
         // extra leading zero to avoid a negative BigInteger 
         assert bytes.length == 33 && bytes[0] == 0;
         System.arraycopy(bytes, 1, result, 0, bytes.length - 1);
      } 
      return result;
   } 
 
   @Override 
   public String getBase58EncodedPrivateKey(NetworkParameters network) {
      if (getPublicKey().isCompressed()) { 
         return getBase58EncodedPrivateKeyCompressed(network);