Character.reverseBytes() in Java with examples
java.lang.Character.reverseBytes() is a built-in method in java which returns the value obtained by reversing the order of the bytes in the specified char value.
public static char reverseBytes(char ch)
Parameter: The function accepts one mandatory parameter ch which signifies the character whose order of bytes is to be reversed.
Returns: This method returns the value obtained by reversing (or, equivalently, swapping) the bytes in the specified char value.
Below programs illustrate the java.lang.Character.reverseBytes() function:
Reversing bytes on ? gives M
Reversing bytes on 9 gives ? Reversing bytes on 7 gives ?
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.