### Question:
MnemonicCode { public List<String> toMnemonic(byte[] entropy) throws MnemonicException.MnemonicLengthException { if (entropy.length % 4 > 0) throw new MnemonicException.MnemonicLengthException("Entropy length not multiple of 32 bits."); if (entropy.length == 0) throw new MnemonicException.MnemonicLengthException("Entropy is empty."); byte[] hash = Sha256Hash.create(entropy).getBytes(); boolean[] hashBits = bytesToBits(hash); boolean[] entropyBits = bytesToBits(entropy); int checksumLengthBits = entropyBits.length / 32; boolean[] concatBits = new boolean[entropyBits.length + checksumLengthBits]; System.arraycopy(entropyBits, 0, concatBits, 0, entropyBits.length); System.arraycopy(hashBits, 0, concatBits, entropyBits.length, checksumLengthBits); ArrayList<String> words = new ArrayList<String>(); int nwords = concatBits.length / 11; for (int i = 0; i < nwords; ++i) { int index = 0; for (int j = 0; j < 11; ++j) { index <<= 1; if (concatBits[(i * 11) + j]) index |= 0x1; } words.add(this.wordList.get(index)); } return words; } MnemonicCode();  MnemonicCode(InputStream wordstream, String wordListDigest); List<String> getWordList(); static byte[] toSeed(List<String> words, String passphrase); byte[] toEntropy(List<String> words); List<String> toMnemonic(byte[] entropy); void check(List<String> words); static long BIP39_STANDARDISATION_TIME_SECS; static MnemonicCode INSTANCE; }### Answer:
@Test(expected = MnemonicException.MnemonicLengthException.class) public void testBadEntropyLength() throws Exception { byte[] entropy = HEX.decode("7f7f7f7f7f7f7f7f7f7f7f7f7f7f"); mc.toMnemonic(entropy); }
@Test(expected = MnemonicException.MnemonicLengthException.class) public void testEmptyEntropy() throws Exception { byte[] entropy = new byte[]{}; mc.toMnemonic(entropy); }