question: public static BigInteger calculateMPrime ( BigInteger n , byte [ ] message ) { if ( n . bitLength ( ) > message . length * 8 ) { return new BigInteger ( 1 , message ) ; } else { int messageBitLength = message . length * 8 ; BigInteger trunc = new BigInteger ( 1 , message ) ; if ( messageBitLength - n . bitLength ( ) > 0 ) { trunc = trunc . shiftRight ( messageBitLength - n . bitLength ( ) ) ; } return trunc ; } }
target:  Method taken (renamed) from SpongyCastle ECDSASigner class. Cannot call from there since it's private and non static.