private int guessTransactionsLength(){
  if (transactionBytesValid)   return bytes.length - HEADER_SIZE;
  if (transactions == null)   return 0;
  int len=VarInt.sizeOf(transactions.size());
  for (  Transaction tx : transactions) {
    len+=tx.length == UNKNOWN_LENGTH ? 255 : tx.length;
  }
  return len;
}

private int guessTransactionsLength ( ) { if ( transactionBytesValid ) return bytes . length - HEADER_SIZE ; if ( transactions == null ) return 0 ; int len = VarInt . sizeOf ( transactions . size ( ) ) ; for ( Transaction tx : transactions ) { len += tx . length == UNKNOWN_LENGTH ? 255 : tx . length ; } return len ; }
provides a reasonable guess at the byte length of the transactions part of the block . the returned value will be accurate in 99 % of cases and in those cases where not will probably slightly oversize . this is used to preallocate the underlying byte array for a bytearrayoutputstream . if the size is under the real value the only penalty is resizing of the underlying byte array .
