fun testShiftRight4() { val aBytes = byteArrayOf(1, -128, 56, 100, -2, -76, 89, 45, 91, 3, -15, 35, 26) val aSign = 1 val number = 45 val rBytes = byteArrayOf(12, 1, -61, 39, -11, -94, -55) val aNumber = BigInteger(aSign, aBytes) val result: BigInteger = aNumber.shiftRight(number) var resBytes = ByteArray(rBytes.size) resBytes = result.toByteArray() for (i in resBytes.indices) { assertTrue(resBytes[i] == rBytes[i]) } assertEquals("incorrect sign", 1, result.signum()) }
shiftRight ( int n ) , n > 32