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.





















Home »
  Java Tutorial »
    java.lang »




Boolean
Byte
Character
Class
Double
Enum
Float
Integer
Long
Math
Number
Object
Package
Process
ProcessBuilder
Runnable
Runtime
SecurityManager
Short
StackTraceElement
StrictMath
String
StringBuffer
StringBuilder
System
Thread
ThreadGroup
ThreadLocal
Throwable