PointEd25519 extends Point { @Override public Point doubling() { Coordinate x1 = this.x; Coordinate y1 = this.y; Coordinate z1 = this.z; Coordinate A = x1.multiply(x1).mod(); Coordinate B = y1.multiply(y1).mod(); Coordinate C = new CoordinateEd25519(BigInteger.ONE.shiftLeft(1)).multiply(z1).multiply(z1).mod(); Coordinate H = A.add(B).mod(); Coordinate E = H.subtract(x1.add(y1).multiply(x1.add(y1)).mod()).mod(); Coordinate G = A.subtract(B).mod(); Coordinate F = C.add(G).mod(); Coordinate X3 = E.multiply(F).mod(); Coordinate Y3 = G.multiply(H).mod(); Coordinate T3 = E.multiply(H).mod(); Coordinate Z3 = F.multiply(G).mod(); return new PointEd25519(X3, Y3, Z3, T3); } PointEd25519(Coordinate x, Coordinate y, Coordinate z, Coordinate t); static PointEd25519 fromAffine(Coordinate x, Coordinate y); @Override final Point add(Point point); @Override Point doubling(); @Override final Point scalarMultiply(BigInteger integer); @Override Point negateY(); @Override final EncodedPoint encode(); @Override Point negate();  }
@Test public void doubling() { Point point1 = PointEd25519.fromAffine( new CoordinateEd25519(new BigInteger("31621228259983782766387151846173419701451207683454700670358544852161525834558")), new CoordinateEd25519(new BigInteger("1087550498622212171315934886475455672530696511327350732598338573849547859723"))); Point result = point1.add(point1); assertThat(result.getAffineX().getInteger(), is(new BigInteger("54335164024625743934669286787931302569680669857893696519224744689691858515668"))); assertThat(result.getAffineY().getInteger(), is(new BigInteger("44807246093863216660634594959379875777640228908622772878292058541219108796161"))); }