FieldElementFp extends FieldElement implements Serializable { @Override public FieldElement addInv() { BigInteger tmp = this.getData().negate(); tmp = tmp.mod(this.getModulus()); return new FieldElementFp(tmp, this.getModulus()); } FieldElementFp(BigInteger data, BigInteger modulus); private  FieldElementFp(); @Override FieldElement add(FieldElement f); @Override FieldElement mult(FieldElement f); @Override FieldElement addInv(); @Override FieldElement multInv();  }
@Test public void testAddInv() { FieldElementFp tmp = (FieldElementFp) e1.addInv(); FieldElementFp result = new FieldElementFp(new BigInteger("56"), modulus); assertEquals(result, tmp); }