MCPcopy Create free account
hub / github.com/antlr/codebuff / toByteArray

Method toByteArray

output/java_guava/1.4.19/Ints.java:315–318  ·  view source on GitHub ↗

Returns a big-endian representation of value in a 4-element byte array; equivalent to ByteBuffer.allocate(4).putInt(value).array(). For example, the input value 0x12131415 would yield the byte array {0x12, 0x13, 0x14, 0x15}. If you need to convert and concatenate

(int value)

Source from the content-addressed store, hash-verified

313 */
314
315 @GwtIncompatible // doesn't work
316 public static byte[] toByteArray(int value) {
317 return new byte[] {(byte) (value >> 24), (byte) (value >> 16), (byte) (value >> 8), (byte) value};
318 }
319
320 /**
321 * Returns the {@code int} value whose big-endian representation is stored in the first 4 bytes of

Callers 2

getCoercedIPv4AddressMethod · 0.95
fromIntegerMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected