private static byte[] readFile(String path) { long size = new File(path).length(); byte[] b = new byte[(int)size]; FileInputStream fis = null; try { fis = new FileInputStream(path); fis.read(b, 0, (int)size); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { try { fis.close(); } catch (IOException e) { e.printStackTrace(); } } return b; }