< prev index next > test/jdk/sun/security/util/math/TestIntegerModuloP.java
Print this page
TestPair<R> right) {
byte[] testResult = func.apply(test, right.test);
byte[] baselineResult = func.apply(baseline, right.baseline);
if (!Arrays.equals(testResult, baselineResult)) {
throw new RuntimeException("Array values do not match: "
- + byteArrayToHexString(testResult) + " != "
- + byteArrayToHexString(baselineResult));
+ + Hex.encoder().encode(testResult) + " != "
+ + Hex.encoder().encode(baselineResult));
}
}
}
- static String byteArrayToHexString(byte[] arr) {
- StringBuilder result = new StringBuilder();
- for (int i = 0; i < arr.length; ++i) {
- byte curVal = arr[i];
- result.append(Character.forDigit(curVal >> 4 & 0xF, 16));
- result.append(Character.forDigit(curVal & 0xF, 16));
- }
- return result.toString();
- }
-
static TestPair<IntegerModuloP>
applyAndCheck(ElemFunction func, TestPair<MutableIntegerModuloP> left,
TestPair<IntegerModuloP> right) {
TestPair<IntegerModuloP> result = left.apply(func, right);
< prev index next >