### Question:
ParseLibrary { static Input inputFor(byte[] fileData) { InputStream in = new ByteArrayInputStream(fileData); if (fileData.length >= 4 && Arrays.equals(flippedHdsm, Arrays.copyOfRange(fileData, 0, 4))) { return new FlippedInputImpl(in); } else { return new InputImpl(in); } }  static void main(String[] args); static Library parse(File f); static Library parse(InputStream in, long fileLength); static String toString(byte[] data); static String toString(byte[] data, byte encodingFlag); static String guessEncoding(byte[] data); int readHtim(Input di, int length);  }### Answer:
@Test public void inputForReturnsAnInput() throws IllegalArgumentException, IOException { byte[] stream = { 'h', 'd', 's', 'm', 0, 0, 0, 1 }; Input input = ParseLibrary.inputFor(stream); assertNotNull(input); assertEquals(Util.fromString("hdsm"), input.readInt()); assertEquals(0x00000001, input.readInt()); }
@Test public void inputForReturnsAByteFlippedInputForAStreamStartingWithMsdh() throws IllegalArgumentException, IOException { byte[] stream = { 'm', 's', 'd', 'h', 1, 0, 0, 0 }; Input input = ParseLibrary.inputFor(stream); assertNotNull(input); assertEquals(Util.fromString("hdsm"), input.readInt()); assertEquals(0x00000001, input.readInt()); }