Guest User

Untitled

a guest
Feb 18th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. //Program stop
  2. try {
  3.  
  4. String body = hce.post("Request URL",
  5. "comand+data+params");
  6. System.out.println(body);
  7. if (body.contains(""status":200")) {
  8. System.out.println("Success");
  9. }
  10. } catch (IOException ioe) {
  11. ioe.printStackTrace();
  12. }
  13.  
  14. try {
  15.  
  16. Path path = Paths.get("CommandsData");
  17. int lineCount = (int) Files.lines(path).count();
  18.  
  19. System.out.println("Number of lines:" + lineCount);
  20.  
  21. String[] strBuf = new String[lineCount];
  22. FileReader fr = new FileReader("CommandsData");
  23. BufferedReader reader = new BufferedReader(fr);
  24.  
  25. for (int i = 0; i < lineCount; i++)
  26. {
  27. strBuf[i] = reader.readLine();
  28. System.out.println(strBuf[i]);
  29. }
  30. reader.close();
  31.  
  32. Random random = new Random();
  33.  
  34. System.out.println("Random strings");
  35. System.out.println(strBuf[random.nextInt(lineCount)]);
  36. System.out.println(strBuf[random.nextInt(lineCount)]);
  37.  
  38. } catch (IOException e) {
  39. e.printStackTrace();
  40. }
  41.  
  42. }
Add Comment
Please, Sign In to add comment