Here you can find the source of readFile(File file)
public static byte[] readFile(File file) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileInputStream; import java.io.IOException; public class Main { public static byte[] readFile(File file) throws IOException { FileInputStream fis = new FileInputStream(file); byte[] buff = new byte[(int) file.length()]; fis.read(buff);//from ww w .j a va 2s.c o m fis.close(); return buff; } }