Java Short.reverseBytes(short i)
Syntax
Short.reverseBytes(short i) has the following syntax.
public static short reverseBytes(short i)
Example
In the following code shows how to use Short.reverseBytes(short i) method.
//ww w . j av a2 s . c o m
public class Main {
public static void main(String[] args) {
short shortNum = 50;
short shortValue = Short.reverseBytes(shortNum);
System.out.println("The reversed value is = " + shortValue);
}
}
The code above generates the following result.