Please am new to java and i need an assistant on loading hexadecimal from a textfile and converting it into binary(Loader class) then the binary will be kept in another class(memory class). then the binary will be forwarded to another output file.

Recommended Answers

Well you would want to first use some fileIO to get in data (link), then after getting the values of the numbers you convert the string of hex to binary with this code

Jump to Post

All 2 Replies

Well you would want to first use some fileIO to get in data (link), then after getting the values of the numbers you convert the string of hex to binary with this code

    int hex = Integer.parseInt("0x00ff00", 16);//parses integer to base 16 (hexadecimal)
    String binary = Integer.toBinaryString(i); //converts hex number to binary
    System.out.println(binary);  //prints binary string

and then just write it to a file. :)

Debascoguy:
DaniWeb Member Rules (which you agreed to when you signed up) include:
"Do provide evidence of having done some work yourself if posting questions from school or work assignments"
http://www.daniweb.com/community/rules

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.