Java Character reverseBytes() Method

The reverseBytes(char ch) method of Character class returns the values obtained by reversing the bytes in a particular order for a given value.

Syntax

Parameter

ch: It is the character that needs to be tested.

Return Value

The reverseBytes(char ch)method returns the value which is obtained by reversing the bytes in their specified char values.

Example 1

Output:

Enter the first input:Helllo
The reversing of the character 'H' will provide the result as:18432
The reversing of the character 'e' will provide the result as:25856
The reversing of the character 'l' will provide the result as:27648
The reversing of the character 'l' will provide the result as:27648
The reversing of the character 'l' will provide the result as:27648
The reversing of the character 'o' will provide the result as:28416
Enter the second input:World
The reversing of the character 'W' will provide the result as:22272
The reversing of the character 'o' will provide the result as:28416
The reversing of the character 'r' will provide the result as:29184
The reversing of the character 'l' will provide the result as:27648
The reversing of the character 'd' will provide the result as:25600

Example 2

Output:

The reversing of bytes for the first character is given as: ]
The reversing of bytes for the second character is given as: M