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 ; }
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 .