MersennePrimeFieldElement implements FieldElement { @Override public FieldElement sqrt() { return create(MathUtils.modularSqrt(value, getModulus())); } private  MersennePrimeFieldElement(BigInteger value, MersennePrimeModulus modulus); @Override FieldElement add(FieldElement operand); @Override FieldElement subtract(FieldElement operand); @Override FieldElement negate(); @Override FieldElement multiply(FieldElement operand); @Override FieldElement sqrt(); @Override FieldElement modInverse(); @Override String toString();  }
@Test public void sqrt() { FieldElement element = MersennePrimeFieldElement.create(2, modulus); FieldElement sqrt = element.sqrt(); BigInteger value = MersennePrimeFieldElement.extractValue(sqrt); assertThat(value, Is.is(BigInteger.valueOf(62))); element = MersennePrimeFieldElement .create("180740608519057052622341767564917758093", bigModulus); BigInteger expected = MersennePrimeFieldElement.extractValue(element); sqrt = element.sqrt(); value = MersennePrimeFieldElement.extractValue(sqrt); assertThat(value.pow(2).mod(bigModulus.getPrime()), Is.is(expected)); }