Guest User

Untitled

a guest
Feb 16th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. hexadecimal text file ~
  2. 33CDAEFFAD
  3. 032DAE01AD
  4. 196CDAEFC0
  5. 21A00D0000
  6. 100CDAEFFA
  7. F3ABCDEFAB
  8. 29A0EDF301
  9. 3ABCDEFABC
  10.  
  11. import java.io.*;
  12. import java.util.ArrayList;
  13. import java.util.Scanner;
  14.  
  15. public class Main
  16. {
  17. // method to convert hex character values into binary
  18.  
  19. static void hexToBin(char hexdec[])
  20. {
  21. int i = 0;
  22.  
  23. while (hexdec[i] != 'u0000')
  24. {
  25. switch (hexdec[i])
  26. {
  27. case '0':
  28. System.out.print("0000");
  29. break;
  30. case '1':
  31. System.out.print("0001");
  32. break;
  33. case '2':
  34. System.out.print("0010");
  35. break;
  36. case '3':
  37. System.out.print("0011");
  38. break;
  39. case '4':
  40. System.out.print("0100");
  41. break;
  42. case '5':
  43. System.out.print("0101");
  44. break;
  45. case '6':
  46. System.out.print("0110");
  47. break;
  48. case '7':
  49. System.out.print("0111");
  50. break;
  51. case '8':
  52. System.out.print("1000");
  53. break;
  54. case '9':
  55. System.out.print("1001");
  56. break;
  57. case 'A':
  58. System.out.print("1010");
  59. break;
  60. case 'B':
  61. System.out.print("1011");
  62. break;
  63. case 'C':
  64. System.out.print("1100");
  65. break;
  66. case 'D':
  67. System.out.print("1101");
  68. break;
  69. case 'E':
  70. System.out.print("1110");
  71. break;
  72. case 'F':
  73. System.out.print("1111");
  74. break;
  75. default:
  76. System.out.print("nInvalid hexadecimal digit " + hexdec[i]);
  77. }
  78. i++;
  79. }
  80. }
  81.  
  82. public static void main(String[] args) throws IOException
  83. {
  84. Scanner sc = new Scanner(new File("RAMerrors8x4c"));
  85. ArrayList<String> values = new ArrayList<String>();
  86. while(sc.hasNext())
  87. {
  88. values.add(sc.nextLine());
  89. }
  90. // pass hex values from text file into arraylist of strings
  91.  
  92. }
  93. }
Add Comment
Please, Sign In to add comment