public void testmodInversePos2(){
  byte aBytes[]={15,24,123,56,-11,-112,-34,-98,8,10,12,14,25,125,-15,28,-127};
  byte mBytes[]={2,122,45,36,100};
  int aSign=1;
  int mSign=1;
  byte rBytes[]={1,-93,40,127,73};
  BigInteger aNumber=new BigInteger(aSign,aBytes);
  BigInteger modulus=new BigInteger(mSign,mBytes);
  BigInteger result=aNumber.modInverse(modulus);
  byte resBytes[]=new byte[rBytes.length];
  resBytes=result.toByteArray();
  for (int i=0; i < resBytes.length; i++) {
    assertTrue(resBytes[i] == rBytes[i]);
  }
  assertEquals("incorrect sign",1,result.signum());
}

public void testmodInversePos2 ( ) { byte aBytes [ ] = { 15 , 24 , 123 , 56 , - 11 , - 112 , - 34 , - 98 , 8 , 10 , 12 , 14 , 25 , 125 , - 15 , 28 , - 127 } ; byte mBytes [ ] = { 2 , 122 , 45 , 36 , 100 } ; int aSign = 1 ; int mSign = 1 ; byte rBytes [ ] = { 1 , - 93 , 40 , 127 , 73 } ; BigInteger aNumber = new BigInteger ( aSign , aBytes ) ; BigInteger modulus = new BigInteger ( mSign , mBytes ) ; BigInteger result = aNumber . modInverse ( modulus ) ; byte resBytes [ ] = new byte [ rBytes . length ] ; resBytes = result . toByteArray ( ) ; for ( int i = 0 ; i < resBytes . length ; i ++ ) { assertTrue ( resBytes [ i ] == rBytes [ i ] ) ; } assertEquals ( "incorrect sign" , 1 , result . signum ( ) ) ; }
modinverse : positive number ( another case : a < 0 )
