public void testConstructorSignBytesNegative6(){
  byte aBytes[]={12,56,100,-2,-76,89,45,91,3,-15,23,-101};
  int aSign=-1;
  byte rBytes[]={-13,-57,-101,1,75,-90,-46,-92,-4,14,-24,101};
  BigInteger aNumber=new BigInteger(aSign,aBytes);
  byte resBytes[]=new byte[rBytes.length];
  resBytes=aNumber.toByteArray();
  for (int i=0; i < resBytes.length; i++) {
    assertTrue(resBytes[i] == rBytes[i]);
  }
  assertEquals("incorrect sign",-1,aNumber.signum());
}

public void testConstructorSignBytesNegative6 ( ) { byte aBytes [ ] = { 12 , 56 , 100 , - 2 , - 76 , 89 , 45 , 91 , 3 , - 15 , 23 , - 101 } ; int aSign = - 1 ; byte rBytes [ ] = { - 13 , - 57 , - 101 , 1 , 75 , - 90 , - 46 , - 92 , - 4 , 14 , - 24 , 101 } ; BigInteger aNumber = new BigInteger ( aSign , aBytes ) ; byte resBytes [ ] = new byte [ rBytes . length ] ; resBytes = aNumber . toByteArray ( ) ; for ( int i = 0 ; i < resBytes . length ; i ++ ) { assertTrue ( resBytes [ i ] == rBytes [ i ] ) ; } assertEquals ( "incorrect sign" , - 1 , aNumber . signum ( ) ) ; }
create a negative number from a sign and an array of bytes . the number of bytes is multiple of 4 . the most significant byte is positive .
