public void testSetBitException(){
  byte aBytes[]={-1,-128,56,100,-2,-76,89,45,91,3,-15,35,26};
  int aSign=1;
  int number=-7;
  BigInteger aNumber=new BigInteger(aSign,aBytes);
  try {
    aNumber.setBit(number);
    fail("ArithmeticException has not been caught");
  }
 catch (  ArithmeticException e) {
  }
}

public void testSetBitException ( ) { byte aBytes [ ] = { - 1 , - 128 , 56 , 100 , - 2 , - 76 , 89 , 45 , 91 , 3 , - 15 , 35 , 26 } ; int aSign = 1 ; int number = - 7 ; BigInteger aNumber = new BigInteger ( aSign , aBytes ) ; try { aNumber . setBit ( number ) ; fail ( "ArithmeticException has not been caught" ) ; } catch ( ArithmeticException e ) { } }
setbit ( int n ) of a negative n
