import java.io.*; public class ReadIntoStr4 { public static void main(String argv[]){ try { FileInputStream file = new FileInputStream (argv[0]); long tcalc ; long begin = System.currentTimeMillis() ; byte[] b = new byte[file.available ()]; file.read(b); file.close (); String result = new String (b); /* */ 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(); } } }