Here you can find the source of toInts(int val)
Parameter | Description |
---|---|
val | Integer to separate. |
public static int[] toInts(int val)
//package com.java2s; //License from project: LGPL public class Main { /**/* w w w. j av a 2s .c o m*/ * Converts each byte in an integer to an integer, places them in MSB order. * * @param val Integer to separate. * @return Array of shifted bytes as an int[]. */ public static int[] toInts(int val) { int[] ints = new int[4]; for (int i = 0; i < 4; i++) { ints[3 - i] = 0xFF & val; val >>= 8; } return ints; } }