Question: Write a Hex Viewer method with the following header: private static void viewHex(String filename) The method reads bytes from filename and displays them in hex
Write a Hex Viewer method with the following header:
private static void viewHex(String filename)
The method reads bytes from filename and displays them in hex representation. The output should be formatted as in the example below, i.e., 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 a 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
