Here you can find the source of unsigned(short value)
Parameter | Description |
---|---|
value | The value to convert. |
public static int unsigned(short value)
//package com.java2s; /*// w w w .ja v a2 s .com * Copyright (c) Fabio Falcinelli 2016. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ public class Main { /** * Convert a short into its unsigned representation as int. * * @param value The value to convert. * @return The unsigned representation. */ public static int unsigned(short value) { return value & 0x0000ffff; } /** * Convert a byte into its unsigned representation as int. * * @param value The value to convert. * @return The unsigned representation. */ public static int unsigned(byte value) { return value & 0x000000ff; } }