### Question:
Base64Codec { static byte[] discardWhitespace(byte[] data) { byte groomedData[] = new byte[data.length]; int bytesCopied = 0; for (byte datum : data) { switch (datum) { case (byte) ' ': case (byte) '\n': case (byte) '\r': case (byte) '\t': break; default: groomedData[bytesCopied++] = datum; } } byte packedData[] = new byte[bytesCopied]; System.arraycopy(groomedData, 0, packedData, 0, bytesCopied); return packedData; }  static boolean isArrayByteBase64(byte[] arrayOctect); static byte[] encodeBase64(byte[] binaryData); static byte[] encodeBase64Chunked(byte[] binaryData); static byte[] encodeBase64(byte[] binaryData, boolean isChunked); static byte[] decodeBase64(byte[] base64Data);  }### Answer:
@Test public void testDiscardWhitespace() throws Exception { String orig = "I am a late night coder."; byte[] encodedArray = Base64Codec.encodeBase64(orig.getBytes()); StringBuffer intermediate = new StringBuffer(new String(encodedArray)); intermediate.insert(2, ' '); intermediate.insert(5, '\t'); intermediate.insert(10, '\r'); intermediate.insert(15, '\n'); byte[] encodedWithWS = intermediate.toString().getBytes(); byte[] encodedNoWS = Base64Codec.discardWhitespace(encodedWithWS); byte[] decodedWithWS = Base64Codec.decodeBase64(encodedWithWS); byte[] decodedNoWS = Base64Codec.decodeBase64(encodedNoWS); String destFromWS = new String(decodedWithWS); String destFromNoWS = new String(decodedNoWS); assertTrue("Dest string doesn't eausl original", destFromWS.equals(orig)); assertTrue("Dest string doesn't eausl original", destFromNoWS.equals(orig)); }