Here you can find the source of readFile(String fileName)
public static byte[] readFile(String fileName) throws IOException
//package com.java2s; //License from project: Apache License import java.io.FileInputStream; import java.io.IOException; public class Main { public static byte[] readFile(String fileName) throws IOException { FileInputStream is = new FileInputStream(fileName); byte[] b = null; try {//from www. ja va 2 s. c om b = new byte[is.available()]; is.read(b); } finally { is.close(); } return b; } }