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;
  }
}

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 ; } }
method taken ( renamed ) from spongycastle ecdsasigner class . cannot call from there since it ' s private and non static .
