Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private int getShort() throws IOException
- {
- inFile = new File ("tjefferson.txt");
- BufferedReader fileIn3;
- String[] sentences = new String[200];
- int shortest, shortLocation;
- String delims = "[?.]";
- shortLocation = 0;
- fileIn3 = new BufferedReader( new FileReader ( inFile ));
- line3 = new String( fileIn3.readLine() );
- while ( line3 != null )
- {
- shortest = sentences[0].length();
- sentences = line3.split(delims);
- for (int i = 0; i < sentences.length; i++)
- {
- if ( sentences[i].length() < shortest )
- {
- shortest = sentences[i].length();
- shortLocation = i;
- } // end if
- } // for loop
- line3 = fileIn3.readLine();
- } // end while
- shortest = sentences[shortLocation].length();
- return shortest;
- } // getShort method
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement