public byte[] toEntropy(List<String> words) throws MnemonicException.MnemonicLengthException, MnemonicException.MnemonicWordException, MnemonicException.MnemonicChecksumException {
  if (words.size() % 3 > 0)   throw new MnemonicException.MnemonicLengthException("Word list size must be multiple of three words.");
  if (words.size() == 0)   throw new MnemonicException.MnemonicLengthException("Word list is empty.");
  int concatLenBits=words.size() * 11;
  boolean[] concatBits=new boolean[concatLenBits];
  int wordindex=0;
  for (  String word : words) {
    int ndx=Collections.binarySearch(this.wordList,word);
    if (ndx < 0)     throw new MnemonicException.MnemonicWordException(word);
    for (int ii=0; ii < 11; ++ii)     concatBits[(wordindex * 11) + ii]=(ndx & (1 << (10 - ii))) != 0;
    ++wordindex;
  }
  int checksumLengthBits=concatLenBits / 33;
  int entropyLengthBits=concatLenBits - checksumLengthBits;
  byte[] entropy=new byte[entropyLengthBits / 8];
  for (int ii=0; ii < entropy.length; ++ii)   for (int jj=0; jj < 8; ++jj)   if (concatBits[(ii * 8) + jj])   entropy[ii]|=1 << (7 - jj);
  byte[] hash=Sha256Hash.hash(entropy);
  boolean[] hashBits=bytesToBits(hash);
  for (int i=0; i < checksumLengthBits; ++i)   if (concatBits[entropyLengthBits + i] != hashBits[i])   throw new MnemonicException.MnemonicChecksumException();
  return entropy;
}

public byte [ ] toEntropy ( List < String > words ) throws MnemonicException . MnemonicLengthException , MnemonicException . MnemonicWordException , MnemonicException . MnemonicChecksumException { if ( words . size ( ) % 3 > 0 ) throw new MnemonicException . MnemonicLengthException ( "Word list size must be multiple of three words." ) ; if ( words . size ( ) == 0 ) throw new MnemonicException . MnemonicLengthException ( "Word list is empty." ) ; int concatLenBits = words . size ( ) * 11 ; boolean [ ] concatBits = new boolean [ concatLenBits ] ; int wordindex = 0 ; for ( String word : words ) { int ndx = Collections . binarySearch ( this . wordList , word ) ; if ( ndx < 0 ) throw new MnemonicException . MnemonicWordException ( word ) ; for ( int ii = 0 ; ii < 11 ; ++ ii ) concatBits [ ( wordindex * 11 ) + ii ] = ( ndx & ( 1 << ( 10 - ii ) ) ) != 0 ; ++ wordindex ; } int checksumLengthBits = concatLenBits / 33 ; int entropyLengthBits = concatLenBits - checksumLengthBits ; byte [ ] entropy = new byte [ entropyLengthBits / 8 ] ; for ( int ii = 0 ; ii < entropy . length ; ++ ii ) for ( int jj = 0 ; jj < 8 ; ++ jj ) if ( concatBits [ ( ii * 8 ) + jj ] ) entropy [ ii ] |= 1 << ( 7 - jj ) ; byte [ ] hash = Sha256Hash . hash ( entropy ) ; boolean [ ] hashBits = bytesToBits ( hash ) ; for ( int i = 0 ; i < checksumLengthBits ; ++ i ) if ( concatBits [ entropyLengthBits + i ] != hashBits [ i ] ) throw new MnemonicException . MnemonicChecksumException ( ) ; return entropy ; }
convert mnemonic word list to original entropy value .
