Advertisement
Somnos

Untitled

Aug 24th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. public class FileData {
  2. public static void main(String[] args) {
  3.  
  4. String file_name = "C:/Users/dhamilton/Documents/20160816 test flight/this one.txt";
  5.  
  6. String[] delimiter = new String[256];
  7. String[] labels = new String[256];
  8.  
  9. for (int j = 0; j < 256; j++) {
  10. String hex = Integer.toHexString(j);
  11. delimiter[j] = "0x10, 0x41, 0x" + hex;
  12.  
  13. String oct = Integer.toOctalString(j);
  14.  
  15. labels[j] = oct;
  16. }
  17.  
  18. try {
  19. ReadFile file = new ReadFile(file_name);
  20. String[] aryLines = file.OpenFile();
  21.  
  22. //String sure = Integer.toBinaryString(i); //FIX THIS
  23. //System.out.println(sure);
  24.  
  25.  
  26. for (int i=0; i<aryLines.length; i++) {
  27. //System.out.println(aryLines[i].length() + "\t" + aryLines[i]);
  28. for (int p=0; p<255; p++) {
  29. if (aryLines[i].contains(delimiter[p])) {
  30. file.addOne(p);
  31. }
  32. }
  33. }
  34.  
  35. for (int q=0; q<256; q++) {
  36. if (file.getCounter(q) != 0) {
  37. System.out.println("Label " + labels[q] + ":\t" + file.getCounter(q));
  38. }
  39. }
  40. }
  41. catch (IOException e) {
  42. System.out.println(e.getMessage());
  43. }
  44.  
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement