Java Integer From intFromByteWithoutStupidJavaSignExtension(byte val)

Here you can find the source of intFromByteWithoutStupidJavaSignExtension(byte val)

Description

int From Byte Without Stupid Java Sign Extension

License

Open Source License

Declaration

final static int intFromByteWithoutStupidJavaSignExtension(byte val) 

Method Source Code

//package com.java2s;

public class Main {
    final static int intFromByteWithoutStupidJavaSignExtension(byte val) {
        int ret = (0x7F) & val;
        if (val < 0) {
            ret += 128;//from w w w.  j av a  2 s.c  o  m
        }
        return ret;
    }
}

Related

  1. intFromBytes(byte[] buffer)
  2. intFromBytes(byte[] buffer, int offset)
  3. intFromBytes(byte[] bytes)
  4. intFromBytes(byte[] bytes)
  5. intFromBytes(byte[] bytes, int offset)
  6. intFromHex(String hex, boolean signed)
  7. intFromJSON(String[] json, int pos)
  8. intFromLex(byte[] bytes)
  9. IntFromRGB(int r, int g, int b)