### Question:
ByteLineReader { public static byte[] chopLine(byte[] lineIn) { ByteArrayOutputStream outStream = new ByteArrayOutputStream(PAGESIZE); for (int i = 0; i < lineIn.length; i++) { int ch = StaticHelpers.ubyte2int(lineIn[i]); if (ch < 0) { break; } if (ch == CR) { continue; } if (ch == LF) { break; } outStream.write(ch); } byte[] line = outStream.toByteArray(); return line; } ByteLineReader(byte[] bytes); int getBytesRead(); int bytesAvailable(); byte[] readLine(boolean chop); byte[] readLine(); static boolean cmpBytes(byte[] a, byte[] b); static byte[] appendLF(byte[] bytesIn); static byte[] copyBytes(byte[] inBytes); static byte[] chopLine(byte[] lineIn); static byte[] trim(byte[] lineIn);  }### Answer:
@Test public void testChop(){ byte[] line1 = asciiBytes("ABCDEF\n"); byte[] line2 = asciiBytes("ABCDEF"); byte[] line3 = asciiBytes("test \n"); byte[] line4 = asciiBytes("test "); assertTrue(bytesMatchString("ABCDEF", ByteLineReader.chopLine(line1))); assertTrue(bytesMatchString("ABCDEF", ByteLineReader.chopLine(line2))); assertTrue(bytesMatchString("test ", ByteLineReader.chopLine(line3))); assertTrue(bytesMatchString("test ", ByteLineReader.chopLine(line4))); }