This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Dec 16th, 2013  |  syntax: Java  |  size: 0.55 KB  |  views: 80  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import jave.io.File;
  2. import java.io.FileNotFoundException;
  3.  
  4. import java.util.Scanner;
  5.  
  6. public class Stats
  7. {
  8.         private static final String FILE_NAME = "numbers.txt";
  9.         private int length = 0;
  10.  
  11.         public static void main (String[] args)
  12.         {
  13.                 Stats test = new Stats();
  14.                 test.lengthCheck();
  15.         }
  16.  
  17.         public void length()
  18.         {
  19.                 try {
  20.                         Scanner keys = new Scanner(new File(FILE_NAME));
  21.                 } catch (FileNotFoundException ex) {
  22.                         System.out.println(ex.toString());
  23.                 }
  24.  
  25.                 while(keys.hasNextInt()) {
  26.                         length++;
  27.                         System.out.print(length);
  28.                 }
  29.         }
  30. }
clone this paste RAW Paste Data