question: public void testFlipBitNegativeOutside1 ( ) { byte aBytes [ ] = { 1 , - 128 , 56 , 100 , - 2 , - 76 , 89 , 45 , 91 , 3 , - 15 , 35 , 26 } ; int aSign = - 1 ; int number = 150 ; byte rBytes [ ] = { - 65 , - 1 , - 1 , - 1 , - 1 , - 1 , - 2 , 127 , - 57 , - 101 , 1 , 75 , - 90 , - 46 , - 92 , - 4 , 14 , - 36 , - 26 } ; BigInteger aNumber = new BigInteger ( aSign , aBytes ) ; BigInteger result = aNumber . flipBit ( number ) ; 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 ( ) ) ; }
target:  flipBit(int n) outside a negative number