ret[0] = (byte)(x & 0xff);
ret[1] = (byte)((x >> 8) & 0xff);
More Related Contents:
- byte array to short array and back again in java
- 2 bytes to short
- how to get the first two bytes from a string in java?
- Convert a string representation of a hex dump to a byte array using Java?
- Java Byte Array to String to Byte Array
- Convert integer into byte array (Java)
- What is short circuiting and how is it used when programming in Java? [duplicate]
- How do I convert Long to byte[] and back in java
- Java integer to byte array
- Is addition of byte converts to int because of java language rules or because of jvm?
- Java’s L number (long) specification
- In Java 8, is there a ByteStream class?
- How are integers cast to bytes in Java?
- How do you specify a byte literal in Java?
- How to convert a byte to its binary string representation
- Java: object to byte[] and byte[] to object converter (for Tokyo Cabinet)
- Java: BufferedImage to byte array and back
- How do I initialize a byte array in Java?
- How to Convert Int to Unsigned Byte and Back
- Convert binary string to byte array
- Set specific bit in byte
- How to convert hex strings to byte values in Java
- Java creating byte array whose size is represented by a long
- Java: why do I receive the error message “Type mismatch: cannot convert int to byte”
- How to get the value of a bit at a certain position from a byte?
- Overflowing Short in java
- James Gosling’s explanation of why Java’s byte is signed
- Why does the xor operator on two bytes produce an int?
- How to convert byte[] to Byte[] and the other way around?
- Searching for a sequence of Bytes in a Binary File with Java