using Java NIO’s ByteBuffer is very simple:
byte[] bytes = ByteBuffer.allocate(4).putInt(1695609641).array();
for (byte b : bytes) {
System.out.format("0x%x ", b);
}
output:
0x65 0x10 0xf3 0x29
More Related Contents:
- Convert integer into byte array (Java)
- In java, is there anyway to go from a array of objects that got returned to the number of objects in the array? [closed]
- add a bigInteger value to a 2d array
- What does value & 0xff do in Java?
- byte array to short array and back again in java
- Java: BufferedImage to byte array and back
- Byte Array to Image object
- How do I initialize a byte array in Java?
- How to convert a Byte Array to an Int Array
- Java creating byte array whose size is represented by a long
- Arrays.asList() of an array
- How do I create an int array with randomly shuffled numbers in a given range [duplicate]
- How to convert byte[] to Byte[] and the other way around?
- Java Iterate Bits in Byte Array
- int[] and Integer[] arrays – What is the difference?
- The best way to print a Java 2D array? [closed]
- Java reverse an int value without using array
- What is the Cost of Calling array.length
- How can I check whether an array is null / empty?
- Converting Integer to String with comma for thousands
- Integer.valueOf() vs. Integer.parseInt() [duplicate]
- How to initialize an array of objects in Java
- Problem with assigning an array to other array in Java
- comparing arrays in java
- Java: why do I receive the error message “Type mismatch: cannot convert int to byte”
- Convert short to byte[] in Java
- How to find the only number in an array that doesn’t occur twice [duplicate]
- Finding the median value of an array?
- Searching for a sequence of Bytes in a Binary File with Java
- Java: Checking equality of arrays (order doesn’t matter)