Question: I need this code to be able to read a hex file and then return it as an string of text HELPPP!!! import java.util.Scanner; import

I need this code to be able to read a hex file and then return it as an string of text HELPPP!!! import java.util.Scanner; import java.io.PrintStream; import java.io.IOException; import java.io.File; public class IOExample3{ public static String printDec(String hexString){ int num1 = Integer.parseInt(hexString, 16); String current = ""; current += (char) num1; return current; } public static void main(String[] args) throws IOException{ Scanner kbReader = new Scanner(System.in); for(boolean repeat = true; repeat == true; ){ System.out.print("Input the filename of a file you wish to read: "); String fName = kbReader.nextLine(); Scanner currFile = new Scanner(new File(fName)); String hexString = currFile.nextLine(), finalString = ""; String[] hexArray = hexString.split("(?<=\\G..)"); for(int i = 0; i < hexArray.length; i++){ finalString += printDec(hexArray[i]); } System.out.println(finalString); currFile.close(); } } } 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!