import java.io.*; public class ReadIntoStr1 { public static void main(String argv[]){ try { FileInputStream file = new FileInputStream (argv[0]); long tcalc ; long begin = System.currentTimeMillis() ; ByteArrayOutputStream bout = new ByteArrayOutputStream() ; int c; while ((c = file.read()) != -1) bout.write(c); file.close (); bout.close(); String result = bout.toString() ; /* */ tcalc = (System.currentTimeMillis() - begin); System.out.println("Compute time: " + tcalc + " ms for " + result.length() + " bytes."); //System.out.println("The string \n " + result) ; } catch (Exception e) { e.printStackTrace(); } } }