### Question:
BitsFormatter { public String format(InputStream input) throws IOException { BufferedInputStream bufferedInput = new BufferedInputStream(input); int nextByte; while ((nextByte = bufferedInput.read()) >= 0) { byteOutput.write(nextByte); } return format(byteOutput.toByteArray()); }  String format(InputStream input); String format(byte[] fst); int stateSize(byte[] fst, int address); String formatState(byte[] fst, int address); String formatStateType(byte stateByte, int address); String formatAddress(int address); String formatArcs(byte[] fst, int address, int accumulateBytes, int jumpBytes); String formatArc(byte[] fst, int address, int accumulateBytes, int jumpBytes);  }### Answer:
@Test public void testFormatCompiled() throws IOException { String inputValues[] = {"cat", "cats", "rats"}; int outputValues[] = {10, 20, 30}; Builder builder = new Builder(); builder.build(inputValues, outputValues); Compiler compiledFST = builder.getCompiler(); assertEquals("" + " 50: MATCH\n" + " 47:\tr -> 30\t(JMP: 39)\n" + " 43:\tc -> 10\t(JMP: 21)\n" + " 39: MATCH\n" + " 36:\ta -> 0\t(JMP: 33)\n" + " 33: MATCH\n" + " 30:\tt -> 0\t(JMP: 27)\n" + " 27: MATCH\n" + " 24:\ts -> 0\t(JMP: 2)\n" + " 21: MATCH\n" + " 18:\ta -> 0\t(JMP: 15)\n" + " 15: MATCH\n" + " 12:\tt -> 0\t(JMP: 9)\n" + " 9: ACCEPT\n" + " 6:\ts -> 10\t(JMP: 2)\n" + " 2: ACCEPT\n", formatter.format(compiledFST.getBytes()) ); }