write a java program to calculate the time taken to read a given number of files. file names should be given at command line.

View Answers

October 30, 2010 at 4:21 PM

Hello Friend,

Try the following code:

import java.util.*;
class  TimeTakenToReadFiles

        public static void main(String[] args){
            Calendar calendar = new GregorianCalendar();
     int hour = calendar.get(Calendar.HOUR);
    int minute = calendar.get(Calendar.MINUTE);
    int second = calendar.get(Calendar.SECOND);
        Scanner input=new Scanner(;
        System.out.println("Enter File names: ");
        String f[]=new String[2];
        for(int i=0;i<f.length;i++){
            for (int i = 0; i < f.length; i++) {

            File file = new File(f[i]);

            try {
                BufferedReader freader = new BufferedReader(new FileReader(file));
                String s;
                while ((s = freader.readLine()) != null) {

                catch(Exception e){}




Related Tutorials/Questions & Answers:
files  write a java program to calculate the time taken to read a given number of files. file names should be given at command line.   Hello Friend, Try the following code: import*; import java.util.*; class
header files
header files   do you have a all header files of java
Uploading files
Uploading files  Hi, Please provide html code for my question. I need to insert the browsed files temporarily to text area while attaching more than one files during mailing
validation files
validation files  If I place validation files in the folder where the action classes are present,will there any error arise
configuration files are used in Struts
configuration files are used in Struts  What configuration files are used in Struts
files uploding and downloading codes
files uploding and downloading codes  any one know JSP codes for upload files,download files and delete files from a created virtual memory
invoking exe files on sound
invoking exe files on sound  how to invoke .exe files on input as sound in java
download pdf files
download pdf files  pls help me,I don't know how to convert .doc,.docx files into pdf files and download that pdf files using servlet or jsp
php merge files
php merge files  Split and merge files in PHP Classes
replacing regex in large files
replacing regex in large files  replacing regex in large files
get files list - Ajax
get files list  Please,friend how to get files list with directories from ftp server or local files on web browser. Thanks, Tin Linn Soe   Hi friend, Index of Files Index
Retrieving list of uploaded files.
Retrieving list of uploaded files.  I need to retrieve list of files... files on a website. its uploaded. now the file resides in a directory in the server. now the list of uploaded files should be showing in page where other users can
files - Java Beginners
files  Why do we require files to store data?  Hi friend, files to store data, easy to find and access them. Thanks
library files - Development process
library files   Hi members, i am trying to develop a media player in java using netbeans but what library files should i import for this development
merge two war files
merge two war files  How to merge two war files using maven??? is there any command
merge two war files
merge two war files  how to merge two war files using maven
php show list of files
php show list of files  How can i pull the limited number of files in PHP
intersection of two files
intersection of two files  hi!could you please provide me with the java program for displaying intersection of two files
Structs jar files
Structs jar files  please Post required jar files for structs. Thanks, L.Mahesh Kumar
compiling .class files
compiling .class files  how do i compile .class files using eclipse
Resource files in iphone
Resource files in iphone  hiii how can we use resource files in iphone development ???   hello, if you want to use any file in your application the first you have to added it in your resource folder .. right click
List files recursively in linux
List files recursively in linux  Hi, How to List files recursively in linux? I want to list all the .php file. Thanks   Hi, You can use following command: find . -name *.php -print Thanks
getting files from VSS
getting files from VSS  I am not able to get the files from VSS.I am using following code. and just let me know is localpath attribute is for our local project path? I am getting the problem in this line failed
Mutliple files upload
Mutliple files upload  Hi Sir, Am doing a project in Jsp and Servlets, i want to upload multiple files inside the grid of the table, and submit the form.Send em the answers as soon as possible..   Please visit