Here you can find the source of byteToShort(byte b)
private static final short byteToShort(byte b)
//package com.java2s; /*/*from w w w .ja v a 2s. com*/ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ public class Main { /** * Convert (signed) byte to (unsigned) short value, i.e., all negative * values become positive. */ private static final short byteToShort(byte b) { return (b < 0) ? (short) (256 + b) : (short) b; } }