Tabnine Logo
Integer.byteValue
Code IndexAdd Tabnine to your IDE (free)

How to use
byteValue
method
in
java.lang.Integer

Best Java code snippets using java.lang.Integer.byteValue (Showing top 20 results out of 3,123)

origin: apache/kafka

public byte[] serialize(String topic, Integer data) {
  if (data == null)
    return null;
  return new byte[] {
    (byte) (data >>> 24),
    (byte) (data >>> 16),
    (byte) (data >>> 8),
    data.byteValue()
  };
}
origin: jfinal/jfinal

  public Byte toByte(Integer self) {
    return self.byteValue();
  }
}
origin: apache/pulsar

@Override
public byte[] encode(Integer message) {
  if (null == message) {
    return null;
  } else {
    return new byte[] {
      (byte) (message >>> 24),
      (byte) (message >>> 16),
      (byte) (message >>> 8),
      message.byteValue()
    };
  }
}
origin: goldmansachs/gs-collections

  public byte byteValueOf(Integer integer)
  {
    return integer.byteValue();
  }
}
origin: ethereum/ethereumj

private byte getOffset(String cap) {
  Integer offset = offsets.get(cap);
  return offset == null ? 0 : offset.byteValue();
}
origin: prestodb/presto

private static Byte intToByte(Integer input)
{
  if (input == null) {
    return null;
  }
  return input.byteValue();
}
origin: wildfly/wildfly

public static byte randomByte() {
 return Integer.valueOf(RandomUtil.random.nextInt()).byteValue();
}
origin: linlinjava/litemall

public static Byte parseByte(String body, String field) {
  ObjectMapper mapper = new ObjectMapper();
  JsonNode node = null;
  try {
    node = mapper.readTree(body);
    JsonNode leaf = node.get(field);
    if (leaf != null) {
      Integer value = leaf.asInt();
      return value.byteValue();
    }
  } catch (IOException e) {
    e.printStackTrace();
  }
  return null;
}
origin: org.assertj/assertj-core

public static byte[] fromHex(String digest) {
 checkNotNull(digest, "The digest should not be null");
 byte[] bytes = new byte[digest.length() / 2];
 for (int i = 0; i < bytes.length; i++) {
  bytes[i] = Integer.valueOf(digest.substring(i * 2, (i + 1) * 2), 16).byteValue();
 }
 return bytes;
}
origin: joel-costigliola/assertj-core

public static byte[] fromHex(String digest) {
 checkNotNull(digest, "The digest should not be null");
 byte[] bytes = new byte[digest.length() / 2];
 for (int i = 0; i < bytes.length; i++) {
  bytes[i] = Integer.valueOf(digest.substring(i * 2, (i + 1) * 2), 16).byteValue();
 }
 return bytes;
}
origin: voldemort/voldemort

public void toBytes(Object object, DataOutputStream output) throws IOException {
  Integer newestVersion = typeDefVersions.lastKey();
  JsonTypeDefinition typeDef = typeDefVersions.get(newestVersion);
  if(hasVersion)
    output.writeByte(newestVersion.byteValue());
  write(output, object, typeDef.getType());
}
origin: hibernate/hibernate-orm

@Override
public RevisionType nullSafeGet(ResultSet resultSet, String[] names, SharedSessionContractImplementor session, Object owner)
    throws HibernateException, SQLException {
  final Integer representationInt = IntegerType.INSTANCE.nullSafeGet( resultSet, names[0], session );
  return representationInt == null ?
      null :
      RevisionType.fromRepresentation( representationInt.byteValue() );
}
origin: org.postgresql/postgresql

public byte getByte(int parameterIndex) throws SQLException {
 checkClosed();
 // fake tiny int with smallint
 checkIndex(parameterIndex, Types.SMALLINT, "Byte");
 if (callResult[parameterIndex - 1] == null) {
  return 0;
 }
 return ((Integer) callResult[parameterIndex - 1]).byteValue();
}
origin: postgresql/postgresql

public byte getByte(int parameterIndex) throws SQLException
{
  checkClosed();
  // fake tiny int with smallint
  checkIndex (parameterIndex, Types.SMALLINT, "Byte");
  
  if (callResult[parameterIndex-1] == null)
    return 0;
  
  return ((Integer)callResult[parameterIndex-1]).byteValue();
}
origin: apache/flink

  @Override
  protected Byte[] getSortedTestData() {

    Random rnd = new Random(874597969123412338L);
    int rndByte = rnd.nextInt(Byte.MAX_VALUE);
    if (rndByte < 0) {
      rndByte = -rndByte;
    }
    if (rndByte == Byte.MAX_VALUE) {
      rndByte -= 3;
    }
    if (rndByte <= 2) {
      rndByte += 3;
    }
    return new Byte[]{
      Byte.valueOf(Byte.MIN_VALUE),
      Byte.valueOf(Integer.valueOf(-rndByte).byteValue()),
      Byte.valueOf(Integer.valueOf(-1).byteValue()),
      Byte.valueOf(Integer.valueOf(0).byteValue()),
      Byte.valueOf(Integer.valueOf(1).byteValue()),
      Byte.valueOf(Integer.valueOf(2).byteValue()),
      Byte.valueOf(Integer.valueOf(rndByte).byteValue()),
      Byte.valueOf(Byte.MAX_VALUE)};
  }
}
origin: voldemort/voldemort

public byte[] toBytes(StringOrder object) {
  return new byte[] { object.getId().byteValue() };
}
origin: apache/flink

  @Override
  protected ByteValue[] getSortedTestData() {

    Random rnd = new Random(874597969123412338L);
    int rndByte = rnd.nextInt(Byte.MAX_VALUE);
    if (rndByte < 0) {
      rndByte = -rndByte;
    }
    if (rndByte == Byte.MAX_VALUE) {
      rndByte -= 3;
    }
    if (rndByte <= 2) {
      rndByte += 3;
    }
    return new ByteValue[]{
      new ByteValue(Byte.MIN_VALUE),
      new ByteValue(Integer.valueOf(-rndByte).byteValue()),
      new ByteValue(Integer.valueOf(-1).byteValue()),
      new ByteValue(Integer.valueOf(0).byteValue()),
      new ByteValue(Integer.valueOf(1).byteValue()),
      new ByteValue(Integer.valueOf(2).byteValue()),
      new ByteValue(Integer.valueOf(rndByte).byteValue()),
      new ByteValue(Byte.MAX_VALUE)};
  }
}
origin: CalebFenton/simplify

@Test
public void canIntToByte() {
  Integer value = 10;
  when(item.getValue()).thenReturn(value);
  when(item.getType()).thenReturn("I");
  when(instruction.getOpcode()).thenReturn(Opcode.INT_TO_BYTE);
  op = (UnaryMathOp) opFactory.create(location, addressToLocation, vm);
  op.execute(node, mState);
  verify(mState, times(1)).assignRegister(eq(REGISTER_A), eq(new HeapItem(value.byteValue(), "B")));
}
origin: org.mongodb/mongo-java-driver

private byte readBinarySubtypeFromExtendedJson() {
  JsonToken subTypeToken = popToken();
  if (subTypeToken.getType() != JsonTokenType.STRING && subTypeToken.getType() != JsonTokenType.INT32) {
    throw new JsonParseException("JSON reader expected a string or number but found '%s'.", subTypeToken.getValue());
  }
  if (subTypeToken.getType() == JsonTokenType.STRING) {
    return (byte) Integer.parseInt(subTypeToken.getValue(String.class), 16);
  } else {
    return subTypeToken.getValue(Integer.class).byteValue();
  }
}
origin: CalebFenton/simplify

@Test
public void testIntToByte() {
  Integer value = 128;
  initial.setRegisters(0, value, "I");
  expected.setRegisters(0, value.byteValue(), "B");
  VMTester.test(CLASS_NAME, "intToByte()V", initial, expected);
}
java.langIntegerbyteValue

Javadoc

Returns the value of this Integer as a byte.

Popular methods of Integer

  • parseInt
    Parses the specified string as a signed integer value using the specified radix. The ASCII character
  • toString
    Converts the specified signed integer into a string representation based on the specified radix. The
  • valueOf
    Parses the specified string as a signed integer value using the specified radix.
  • intValue
    Gets the primitive value of this int.
  • <init>
    Constructs a new Integer from the specified string.
  • toHexString
    Returns a string representation of the integer argument as an unsigned integer in base 16.The unsign
  • equals
    Compares this instance with the specified object and indicates if they are equal. In order to be equ
  • compareTo
    Compares this Integer object to another object. If the object is an Integer, this function behaves l
  • hashCode
  • compare
    Compares two int values.
  • longValue
    Returns the value of this Integer as along.
  • decode
    Parses the specified string and returns a Integer instance if the string can be decoded into an inte
  • longValue,
  • decode,
  • numberOfLeadingZeros,
  • getInteger,
  • doubleValue,
  • toBinaryString,
  • bitCount,
  • shortValue,
  • highestOneBit

Popular in Java

  • Parsing JSON documents to java classes using gson
  • startActivity (Activity)
  • requestLocationUpdates (LocationManager)
  • putExtra (Intent)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • Collectors (java.util.stream)
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now