Java Utililty Methods Unsigned Byte Create

List of utility methods to do Unsigned Byte Create

  1. HOME
  2. Java
  3. U
  4. Unsigned Byte Create

Description

The list of methods to do Unsigned Byte Create are organized into topic(s).

Method

int toUnsignedByte(byte b)
Converts the signed byte to its unsigned integer representation.
return (int) (b & 0xFF);
short toUnsignedByte(byte b)
Converts a byte to the corresponding unsigned byte value and returns the result as a short
return (short) (b & MAX_BYTE);
short toUnsignedByte(byte b)
Convert a byte to unsigned byte
return Integer.valueOf(b & 0xFF).shortValue();
int toUnsignedByte(byte b)
This method gets eventually inlined, becoming very fast
return (0x000000FF & b);
short toUnsignedByte(byte value)
Return the unsigned byte value [0|255] from the java byte value [-128|127].
return (short) (value - Byte.MIN_VALUE);
int toUnsignedByte(byte[] buf, int pos)
to Unsigned Byte
int b = buf[pos];
if (b < 0) {
 b = 256 + b;
return b;
short toUnsignedByte(char[] bytes, boolean le)
to Unsigned Byte
if (bytes.length != 2)
 return 0;
return (short) Long.parseLong(bytesToString(bytes, le, false), 16);
byte toUnsignedByte(int value)
Transforms the given integer value to an byte-value representing a number between 0 and 255.
if (value > 255 || value < 0) {
 throw new IllegalArgumentException(
 "Unsigned byte value range is between 0 and 255 - the value [" + value + "] is not valid.");
return (byte) value;
int toUnsignedByte(int value)
to Unsigned Byte
return value &= UNSIGNED_BYTE_MAX;
int[] toUnsignedByteArray(byte[] b)
to Unsigned Byte Array
int[] r = new int[b.length];
for (int i = 0; i < b.length; i++) {
 r[i] = b[i] + 0x80;
return r;


AltStyle によって変換されたページ (->オリジナル) /