code: public static SecretShare decodeFromBinary(byte[] data) {
          ByteBuffer bb = ByteBuffer.wrap(data);
          try {
              byte[] signature = new byte[SIGNATURE.length];
              bb.get(signature);
              if (!Arrays.equals(SIGNATURE, signature)) {
                  throw new IllegalArgumentException("signature missing");
              }
              byte n = bb.get();
              int shareDataLen = bb.getInt();
              byte[] shareData = new byte[shareDataLen];
              bb.get(shareData);
              int primeDataLen = bb.getInt();
              byte[] primeData = new byte[primeDataLen];
              bb.get(primeData);
  
              BigInteger share = new BigInteger(shareData);
              BigInteger prime = new BigInteger(primeData);
              if (share.compareTo(BigInteger.ZERO) <= 0) {
                  throw new IllegalArgumentException("invalid share number");
              }
              if (prime.compareTo(BigInteger.ZERO) <= 0) {
                  throw new IllegalArgumentException("invalid prime");
              }
              return new SecretShare(n, share, prime);
          } catch (BufferUnderflowException ex) {
              throw new IllegalArgumentException(ex);
          }
      }
docs: De-serialize secret share from binary message data. Serialization mechanism is detailed in {@link #encodeToBinary(rs.in.zivanovic.sss.SecretShare)
  }
  
  @param data binary data to de-serialize
  @return secret share data