public byte[] encodeToBitcoin(){
  try {
    ByteArrayOutputStream bos=derByteStream();
    bos.write(sighashFlags);
    return bos.toByteArray();
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}

public byte [ ] encodeToBitcoin ( ) { try { ByteArrayOutputStream bos = derByteStream ( ) ; bos . write ( sighashFlags ) ; return bos . toByteArray ( ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } }
what we get back from the signer are the two components of a signature , r and s . to get a flat byte stream of the type used by bitcoin we have to encode them using der encoding , which is just a way to pack the two components into a structure , and then we append a byte to the end for the sighash flags .
