code: private static boolean checkSamePrimes(List<SecretShare> shares) {
          boolean ret = true;
          BigInteger prime = null;
          for (SecretShare share : shares) {
              if (prime == null) {
                  prime = share.getPrime();
              } else if (!prime.equals(share.getPrime())) {
                  ret = false;
                  break;
              }
          }
          return ret;
      }
docs: Verify if all shares have the same prime. If they do not, then they are not from the same series and cannot
  possibly be joined.
  
  @param shares to check
  @return true if all shares have the same prime, false if not.