Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- hexadecimal text file ~
- 33CDAEFFAD
- 032DAE01AD
- 196CDAEFC0
- 21A00D0000
- 100CDAEFFA
- F3ABCDEFAB
- 29A0EDF301
- 3ABCDEFABC
- import java.io.*;
- import java.util.ArrayList;
- import java.util.Scanner;
- public class Main
- {
- // method to convert hex character values into binary
- static void hexToBin(char hexdec[])
- {
- int i = 0;
- while (hexdec[i] != 'u0000')
- {
- switch (hexdec[i])
- {
- case '0':
- System.out.print("0000");
- break;
- case '1':
- System.out.print("0001");
- break;
- case '2':
- System.out.print("0010");
- break;
- case '3':
- System.out.print("0011");
- break;
- case '4':
- System.out.print("0100");
- break;
- case '5':
- System.out.print("0101");
- break;
- case '6':
- System.out.print("0110");
- break;
- case '7':
- System.out.print("0111");
- break;
- case '8':
- System.out.print("1000");
- break;
- case '9':
- System.out.print("1001");
- break;
- case 'A':
- System.out.print("1010");
- break;
- case 'B':
- System.out.print("1011");
- break;
- case 'C':
- System.out.print("1100");
- break;
- case 'D':
- System.out.print("1101");
- break;
- case 'E':
- System.out.print("1110");
- break;
- case 'F':
- System.out.print("1111");
- break;
- default:
- System.out.print("nInvalid hexadecimal digit " + hexdec[i]);
- }
- i++;
- }
- }
- public static void main(String[] args) throws IOException
- {
- Scanner sc = new Scanner(new File("RAMerrors8x4c"));
- ArrayList<String> values = new ArrayList<String>();
- while(sc.hasNext())
- {
- values.add(sc.nextLine());
- }
- // pass hex values from text file into arraylist of strings
- }
- }
Add Comment
Please, Sign In to add comment