Java tutorial
//package com.java2s; import java.io.File; import java.io.IOException; import java.io.RandomAccessFile; public class Main { private static String readSaltFromFile(File file) throws IOException { RandomAccessFile accessFile = new RandomAccessFile(file, "r"); byte[] bs = new byte[(int) accessFile.length()]; accessFile.readFully(bs); accessFile.close(); return new String(bs); } }