Java Number Swap swapShort(short value)

Here you can find the source of swapShort(short value)

Description

Reverses the byte order of the source short value

License

Apache License

Parameter

Parameter Description
value the source value

Return

the converted value

Declaration

public static short swapShort(short value) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    /**// w ww  . ja  v  a  2s . c om
     * Reverses the byte order of the source <tt>short</tt> value
     * @param value the source value
     * @return the converted value
     */
    public static short swapShort(short value) {
        return (short) (((value & 0xFF00) >> 8) | ((value & 0x00FF) << 8));
    }
}

Related

  1. swapLong(long value)
  2. swapLong(long value)
  3. swapLong(long value)
  4. swapShort(final short value)
  5. swapShort(short value)