public boolean isNegative() { return f.getEncoding().isNegative(this); }
@Test public void isNegativeReturnsCorrectResult() { for (int i=0; i<10000; i++) { // Arrange: final int[] t = new int[10]; for (int j=0; j<10; j++) { t[j] = random.nextInt(1 << 28) - (1 << 27); } final boolean isNegative = MathUtils.toBigInteger(t).mod(MathUtils.getQ()).mod(new BigInteger("2")).equals(BigInteger.ONE); final FieldElement f = new Ed25519FieldElement(MathUtils.getField(), t); // Assert: Assert.assertThat(MathUtils.getField().getEncoding().isNegative(f), IsEqual.equalTo(isNegative)); } } }
public boolean isNegative() { return f.getEncoding().isNegative(this); }