Question: In Java: Write a Hex Viewer method with the following header to read a binary file. private static void viewHex(String filename) This method reads bytes
In Java:
Write a Hex Viewer method with the following header to read a binary file.
private static void viewHex(String filename)
This method reads bytes from a data.dat file and a counter file.dat(you can create a small sample) and displays them in hex representation. The output should be formatted as shown in the example below. Each line consists of 8 pairs of hex numbers, then |, then another 8 pairs. Use Integer.toHexString( ) to convert a byte into a string representing the equivalent hex. Use try statement to handle IOException and display a simple error message if an I/O exception occurs.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
