public static byte[] readByteArray(String fileName) throws IOException {
        File f = new File(fileName);

        if (!(f.exists() && f.canRead())) {
            throw new FileNotFoundException(fileName+" is not found");
        }

        byte[] data = new byte[ (int)f.length() ];
        InputStream inStream = new FileInputStream(f);

        try {
            inStream.read(data);
        } finally {
            inStream.close();
        }

        return data;
    }