Java tutorial
//package com.java2s; import java.io.File; import java.io.IOException; import java.io.RandomAccessFile; public class Main { public static byte[] readFilename(String filename) throws IOException { return readFile(new File(filename)); } public static byte[] readFile(File f1) throws IOException { RandomAccessFile f = new RandomAccessFile(f1, "r"); byte[] b = new byte[(int) f.length()]; f.read(b); f.close(); return b; } }