code: public byte[] toByteArray() {
      switch (this.repr) {
        case P2:
        case P3:
          FieldElement recip = Z.invert();
          FieldElement x = X.multiply(recip);
          FieldElement y = Y.multiply(recip);
          byte[] s = y.toByteArray();
          s[s.length - 1] |= (x.isNegative() ? (byte) 0x80 : 0);
          return s;
        default:
          return toP2().toByteArray();
      }
    }
docs: Converts the group element to an encoded point on the curve.
  
  @return The encoded point as byte array.