private static byte[] encodeUncompressedPoint(EllipticCurve curve, ECPoint point)
      throws GeneralSecurityException {
    int coordinateSize = EllipticCurves.fieldSizeInBytes(curve);
    byte[] encoded = new byte[2 * coordinateSize + 1];
    byte[] x = BigIntegerEncoding.toBigEndianBytes(point.getAffineX());
    byte[] y = BigIntegerEncoding.toBigEndianBytes(point.getAffineY());
    // Order of System.arraycopy is important because x,y can have leading 0's.
    System.arraycopy(y, 0, encoded, 1 + 2 * coordinateSize - y.length, y.length);
    System.arraycopy(x, 0, encoded, 1 + coordinateSize - x.length, x.length);
    encoded[0] = 4;
    return encoded;
  }
Copied from {@link EllipticCurves#pointEncode} to bypass point validation.
java_src/src/test/java/com/google/crypto/tink/hybrid/HpkePublicKeyTest.java