Java tutorial
//package com.java2s; //License from project: Apache License import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; public class Main { public static int getHistory(String extractPath, String md5) { StringBuilder reval = new StringBuilder(); try { InputStream in = new FileInputStream(extractPath + "/history_" + md5); byte[] buf = new byte[1024]; int c = 0; while ((c = in.read(buf)) >= 0) { reval.append(new String(buf, 0, c)); } in.close(); } catch (IOException e) { e.printStackTrace(); return 1; } try { return Integer.parseInt(reval.toString()); } catch (Exception e) { return 0; } } }