question: public void testPowNegativeNumToOddExp ( ) { byte aBytes [ ] = { 50 , - 26 , 90 , 69 , 120 , 32 , 63 , - 103 , - 14 , 35 } ; int aSign = - 1 ; int exp = 5 ; byte rBytes [ ] = { - 21 , - 94 , - 42 , - 15 , - 127 , 113 , - 50 , - 88 , 115 , - 35 , 3 , 59 , - 92 , 111 , - 75 , 103 , - 42 , 41 , 34 , - 114 , 99 , - 32 , 105 , - 59 , 127 , 45 , 108 , 74 , - 93 , 105 , 33 , 12 , - 5 , - 20 , 17 , - 21 , - 119 , - 127 , - 115 , 27 , - 122 , 26 , - 67 , 109 , - 125 , 16 , 91 , - 70 , 109 } ; BigInteger aNumber = new BigInteger ( aSign , aBytes ) ; BigInteger result = aNumber . pow ( exp ) ; 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:  Exponentiation of a negative number to an odd exponent.