byte To Word - Java java.lang

Java examples for java.lang:String UTF

Description

byte To Word

Demo Code


//package com.java2s;

public class Main {
    public static long byteToWord(byte btValue[]) {
        return (long) (fixSignedByte(btValue[0]) + fixSignedByte(btValue[1]) * 256);
    }/*w ww. j av  a 2  s  .  c o m*/

    public static short fixSignedByte(byte btValue) {
        if (btValue < 0)
            return (short) (btValue + 256);
        return btValue;
    }
}

Related Tutorials