Question: Write a java program that takes an input string, converts each character of the string to a hexidecimal value, and stores it in a 2-dimensional

Write a java program that takes an input string, converts each character of the string to a hexidecimal value, and stores it in a 2-dimensional array (matrix). The 2-dimensional array must be of size 4x4. Within the program, create a method that repeatedly takes an input string length of 16 and prints out a 4x4 array (each 4x4 array separated by a space) until the input string is completely converted an stored in an array (this case would occur if the input string length is greater than 16). Array must be filled in a column by column order. Any remaining space in the array should be filled with a substitution character, resulting in a padded matrix. Input starts with a desired substituion character, next line is followed by the input string.

Example input 1:

~

Hola

Example output 1:

48 20 7E

6F 7E 7E

6C 7E 7E

61 7E 7E

Example input 2:

0

Een goede naam is beter.

Example output 2:

45 67 65 61

65 6F 20 6D

6E 65 6E 20

20 64 61 69

(space)

73 74 30 30

20 75 30 30

62 72 30 30

65 2E 30 30

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!