Here you can find the source of unsignedToSigned8(char value)
Parameter | Description |
---|---|
value | the unsigned value |
public static short unsignedToSigned8(char value)
//package com.java2s; public class Main { /**/*w w w .j ava 2s . c om*/ * Converts the specified unsigned 8 bit value to a signed 8 bit value. * If the value specified is actually a 16 bit value, only the lower 8 bit * will be used. * @param value the unsigned value * @return the signed value */ public static short unsignedToSigned8(char value) { char workvalue = (char) (value & 0xff); return (short) (workvalue > Byte.MAX_VALUE ? -(255 - (workvalue - 1)) : workvalue); } }