コード例 #1
0
  public byte[] toBytes() {
    byte[] xBytes = x.toBytes();
    byte[] yBytes = y.toBytes();

    byte[] result = new byte[xBytes.length + yBytes.length];
    Arraycopy.arraycopy_custom(xBytes, 0, result, 0, xBytes.length);
    Arraycopy.arraycopy_custom(yBytes, 0, result, xBytes.length, yBytes.length);

    return result;
  }
コード例 #2
0
  public byte[] toBytesCompressed() {
    byte[] xBytes = x.toBytes();
    byte[] result = new byte[getLengthInBytesCompressed()];
    Arraycopy.arraycopy_custom(xBytes, 0, result, 0, xBytes.length);

    if (y.sign() > 0) result[xBytes.length] = 1;
    else result[xBytes.length] = 0;

    return result;
  }