public static byte[] read(String aInputFileName) {
        log.info("Reading in binary file named : " + aInputFileName);
        File file = new File(aInputFileName);
        log.info("File size: " + file.length());
        byte[] result = new byte[(int) file.length()];
        try {
            InputStream input = null;
            try {
                int totalBytesRead = 0;
                input = new BufferedInputStream(new FileInputStream(file));
                while (totalBytesRead < result.length) {
                    int bytesRemaining = result.length - totalBytesRead;
                    // input.read() returns -1, 0, or more :
                    int bytesRead = input.read(result, totalBytesRead,
                            bytesRemaining);
                    if (bytesRead > 0) {
                        totalBytesRead = totalBytesRead + bytesRead;
                    }
                }
                /*
                 * the above style is a bit tricky: it places bytes into the
                 * 'result' array; 'result' is an output parameter; the while
                 * loop usually has a single iteration only.
                 */
                log.info("Num bytes read: " + totalBytesRead);
            } finally {
                log.info("Closing input stream.");
                input.close();
            }
        } catch (FileNotFoundException ex) {
            log.error("File not found.");
        } catch (IOException ex) {
            log.error("e:" + ex);
        }
        return result;
    }