Here you can find the source of readFile(String filePath)
public static byte[] readFile(String filePath) throws Exception
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.FileInputStream; public class Main { public static byte[] readFile(String filePath) throws Exception { FileInputStream fis = new FileInputStream(new File(filePath)); byte[] bytes = new byte[fis.available()]; fis.read(bytes);//from w w w .j a v a 2 s . c o m fis.close(); return bytes; } }