public void testCase8(){
  byte aBytes[]={10,20,30,40,50,60,70,10,20,30};
  byte bBytes[]={1,2,3,4,5,6,7,1,2,3,4,5,6,7};
  byte rBytes[]={1,2,3,4,15,26,37,41,52,63,74,15,26,37};
  BigInteger aNumber=new BigInteger(aBytes);
  BigInteger bNumber=new BigInteger(bBytes);
  BigInteger result=aNumber.add(bNumber);
  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 testCase8 ( ) { byte aBytes [ ] = { 10 , 20 , 30 , 40 , 50 , 60 , 70 , 10 , 20 , 30 } ; byte bBytes [ ] = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 1 , 2 , 3 , 4 , 5 , 6 , 7 } ; byte rBytes [ ] = { 1 , 2 , 3 , 4 , 15 , 26 , 37 , 41 , 52 , 63 , 74 , 15 , 26 , 37 } ; BigInteger aNumber = new BigInteger ( aBytes ) ; BigInteger bNumber = new BigInteger ( bBytes ) ; BigInteger result = aNumber . add ( bNumber ) ; 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 ( ) ) ; }
add two positive numbers of different length . the second is longer .
