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