Here you can find the source of getByteFromFile(String fileName)
public static byte[] getByteFromFile(String fileName) throws Exception
//package com.java2s; import java.io.File; import java.io.FileInputStream; public class Main { public static byte[] getByteFromFile(String fileName) throws Exception { File file = new File(fileName); FileInputStream fis = new FileInputStream(file); int length = fis.available(); byte[] buffer = new byte[length]; fis.read(buffer);//from w w w .ja va2 s. co m fis.close(); return buffer; } }