@Override public String serialize(boolean production){
  ByteArrayOutputStream out=new ByteArrayOutputStream();
  try {
    if (production) {
      out.write(xprv);
    }
 else {
      out.write(tprv);
    }
    out.write(depth & 0xff);
    out.write((parent >>> 24) & 0xff);
    out.write((parent >>> 16) & 0xff);
    out.write((parent >>> 8) & 0xff);
    out.write(parent & 0xff);
    out.write((sequence >>> 24) & 0xff);
    out.write((sequence >>> 16) & 0xff);
    out.write((sequence >>> 8) & 0xff);
    out.write(sequence & 0xff);
    out.write(chainCode);
    out.write(0x00);
    out.write(master.toByteArray());
  }
 catch (  IOException e) {
  }
  return ByteUtils.toBase58WithChecksum(out.toByteArray());
}

@ Override public String serialize ( boolean production ) { ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ; try { if ( production ) { out . write ( xprv ) ; } else { out . write ( tprv ) ; } out . write ( depth & 0xff ) ; out . write ( ( parent > > > 24 ) & 0xff ) ; out . write ( ( parent > > > 16 ) & 0xff ) ; out . write ( ( parent > > > 8 ) & 0xff ) ; out . write ( parent & 0xff ) ; out . write ( ( sequence > > > 24 ) & 0xff ) ; out . write ( ( sequence > > > 16 ) & 0xff ) ; out . write ( ( sequence > > > 8 ) & 0xff ) ; out . write ( sequence & 0xff ) ; out . write ( chainCode ) ; out . write ( 0x00 ) ; out . write ( master . toByteArray ( ) ) ; } catch ( IOException e ) { } return ByteUtils . toBase58WithChecksum ( out . toByteArray ( ) ) ; }
serialize into a base58 string in bip32 convention
