Here you can find the source of readFile(final String fileNamePath)
public static byte[] readFile(final String fileNamePath) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.FileInputStream; import java.io.IOException; public class Main { public static byte[] readFile(final String fileNamePath) throws IOException { FileInputStream input = null; byte[] daten = null; try {// w ww .j a v a 2 s . c om input = new FileInputStream(fileNamePath); daten = new byte[input.available()]; input.read(daten); } finally { if (input != null) { input.close(); } } return daten; } }