Advertisement
Guest User

Untitled

a guest
Nov 25th, 2015
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.36 KB | None | 0 0
  1. import java.io.*;
  2. import java.nio.file.Files;
  3. import java.util.ArrayList;
  4.  
  5.  
  6. public class Main {
  7.  
  8. public static void main(String[] args) {
  9.  
  10.  
  11.  
  12. long start = System.nanoTime();
  13.  
  14.  
  15.  
  16. int MaxWordLength = 64;
  17. ArrayList<String []> AllWords;
  18.  
  19.  
  20. AllWords = new ArrayList<String[]>();
  21. byte[] array;
  22. try {
  23. array = Files.readAllBytes(new File("O:\\odm.txt").toPath());
  24. } catch (IOException e) {
  25. e.printStackTrace();
  26. }
  27.  
  28.  
  29. /**
  30. while(true)
  31. {
  32. int CharacterRead = 0;
  33. try {
  34. CharacterRead = BR.read();
  35. } catch (IOException e) {
  36. e.printStackTrace();
  37. }
  38. if(CharacterRead == -1)
  39. break;
  40.  
  41. if(CharacterRead >= 'a' && CharacterRead <= 'z')
  42. {
  43. if(SB == null)
  44. SB = new StringBuilder(MaxWordLength);
  45.  
  46. SB.append((char) CharacterRead);
  47. }
  48. else
  49. {
  50. if(SB != null && SB.length() > 0)
  51. {
  52. AllWords.add(SB.toString());
  53. SB = null;
  54. }
  55. }
  56. }*/
  57. String s = null;
  58. do {
  59.  
  60. try {
  61. s = BR.readLine();
  62. } catch (IOException e) {
  63. e.printStackTrace();
  64. }
  65. if (s !=null)
  66. AllWords.add(s.replaceAll("^[,\\s]+", "").split("[,\\s]+"));
  67.  
  68. } while (s !=null);
  69.  
  70.  
  71. try {
  72. BR.close();
  73. } catch (IOException e) {
  74. e.printStackTrace();
  75. }
  76.  
  77.  
  78.  
  79.  
  80. long elapsedTime = System.nanoTime() - start;
  81.  
  82. double seconds = (double)elapsedTime / 1000000000.0;
  83.  
  84. System.out.println(seconds);
  85. System.gc();
  86.  
  87. BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
  88. System.out.print("Please enter user name : ");
  89. String username = null;
  90. try {
  91. username = reader.readLine();
  92. } catch (IOException e) {
  93. e.printStackTrace();
  94. }
  95. System.out.println("You entered : " + username);
  96. }
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement