Java Unsigned Number Create unsignedToSigned16(char value)

Here you can find the source of unsignedToSigned16(char value)

Description

Converts the specified unsigned 16 bit value to a signed 16 bit value.

License

Open Source License

Parameter

Parameter Description
value the unsigned value

Return

the signed value

Declaration

public static short unsignedToSigned16(char value) 

Method Source Code

//package com.java2s;

public class Main {
    /**/*from www .  jav  a  2s .  c  o  m*/
     * Converts the specified unsigned 16 bit value to a signed 16 bit value.
     * @param value the unsigned value
     * @return the signed value
     */
    public static short unsignedToSigned16(char value) {
        return (short) (value > Short.MAX_VALUE ? -(Character.MAX_VALUE - (value - 1)) : value);
    }
}

Related

  1. unsignedToBytes(byte b)
  2. unsignedToSigned(int unsigned, int size)
  3. unsignedToSigned(int[] ints)
  4. unsignedToSigned(int[] unsignedBytes)
  5. unsignedToSigned(long value, int size)
  6. unsignedToSigned8(char value)
  7. unsignedUnion2by2(final short[] set1, final int length1, final short[] set2, final int length2, final short[] buffer)
  8. unsignedUpcast(short s)
  9. unsignedValue(byte signedByte)