Home » Java Short reverseBytes() method with Examples

Java Short reverseBytes() method with Examples

by Online Tutorials Library

Java Short reverseBytes() method

The reverseBytes() method of Java Short class is used to obtain a primitive short value reversing the order of bits in two?s complement form of the given short value.

Syntax

Parameters

S: The value whose bytes will be reversed.

Return value

It returns the value obtained by reversing the bytes in the specified short value.

Exception

N/A

Example 1

Test it Now

Output:

Reversed short value is = 7680  

Example 2

Test it Now

Output:

Reversed short value is = 23040  

Example 3

Test it Now

Output:

Reversed short value is = -3071  

Next TopicJava Short

You may also like