### Question:
ByteLineReader { public static byte[] trim(byte[] lineIn) { byte[] out; int hi; int ti; int outSize; String lineInStr = StringUtils.asciiString(lineIn); for (hi = 0; hi < lineIn.length; hi++) { if (!StaticHelpers.isByteWhiteSpace(lineIn[hi])) { break; } } for (ti = lineIn.length - 1; ti >= 0; ti--) { if (!StaticHelpers.isByteWhiteSpace(lineIn[ti])) { break; } } outSize = ti - hi + 1; if (outSize <= 0) { return new byte[0]; } out = new byte[outSize]; for (int i = 0; i < outSize; i++) { out[i] = lineIn[hi + i]; } String outStr = StringUtils.asciiString(out); return out; } 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 testTrime(){ byte[] line1 = asciiBytes(" trim this "); byte[] line2 = asciiBytes(" "); byte[] line3 = asciiBytes(" \u001eRecord Seperator\u001f "); assertTrue(bytesMatchString("trim this",ByteLineReader.trim(line1))); assertTrue(bytesMatchString("",ByteLineReader.trim(line2))); assertTrue(bytesMatchString("Record Seperator",ByteLineReader.trim(line3))); assertTrue(bytesMatchString("test",ByteLineReader.trim(asciiBytes(" test")))); assertTrue(bytesMatchString("test",ByteLineReader.trim(asciiBytes(" test ")))); assertTrue(bytesMatchString("test",ByteLineReader.trim(asciiBytes("test ")))); assertTrue(bytesMatchString("",ByteLineReader.trim(asciiBytes(" ")))); assertTrue(bytesMatchString("",ByteLineReader.trim(asciiBytes("")))); assertFalse(bytesMatchString("FAIL",ByteLineReader.trim(asciiBytes("PFFT")))); }