Java Integer Create toInt(byte value)

Here you can find the source of toInt(byte value)

Description

Interpret the byte value as unsigned.

License

Open Source License

Parameter

Parameter Description
value the byte value

Return

the value of the byte as an int, as if the byte was unsigned

Declaration

public static int toInt(byte value) 

Method Source Code

//package com.java2s;
/* IcosaMapper - an rpg map editor based on equilateral triangles that form an icosahedron
 * Copyright (C) 2013  Ville Jokela//from  w  w w.ja va2  s  .com
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * contact me <ville.jokela@penny-craal.org>
 */

public class Main {
    /**
     * Interpret the byte value as unsigned.
     * @param value the byte value
     * @return the value of the byte as an int, as if the byte was unsigned
     */
    public static int toInt(byte value) {
        return value & 0xFF;
    }
}

Related

  1. toInt(byte byte0, byte byte1, byte byte2, byte byte3)
  2. toInt(byte byte3, byte byte2, byte byte1, byte byte0)
  3. toInt(byte in0, byte in1, byte in2, byte in3)
  4. toInt(byte mostSignificant, byte leastSignificant)
  5. toInt(byte src)
  6. toInt(byte... b)
  7. toInt(byte... b)
  8. toInt(byte[] b)
  9. toInt(byte[] b)