Is there a simple implementation (using Java BigInteger) of ElGamal elliptic curve cryptosystem with key generation, encryption and decryption functions; one that could be used to explain to university students in a lecture?

For example, a Paillier encrypt function can be coded, without loss of generality, as:

```
public BigInteger encrypt(BigInteger input) throws PaillierException  {
    if(!isInZN(input)) {
        throw new PaillierException(PaillierException.TYPE_PLAINTEXT_NOT_IN_ZN, input);
    }
    BigInteger plaintext = handleNegative(input);
    BigInteger r = randomInZStarN();
    return (((n.multiply(plaintext).add(BigInteger.ONE)).multiply(r.modPow(n, nSquared)))).mod(nSquared);
}

```

which contains an optimisation g=(1+n), which makes the ciphertext c = (1 + mn) r^n mod n^2.

Please **DO NOT** suggest the Java 7 native implementation or BouncyCastle ones because I don't need a real world JCA compliant complex implementation.

Thanks.