Here you can find the source of intToFourBytes(int i)
private static byte[] intToFourBytes(int i)
//package com.java2s; /******************************************************************************* * Copyright (c) 2016 Dr.-Ing. Marc M?ltin. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors://from w w w. j a v a 2 s. c om * Dr.-Ing. Marc M?ltin - initial API and implementation and initial documentation *******************************************************************************/ public class Main { private static byte[] intToFourBytes(int i) { byte[] res = new byte[4]; res[0] = (byte) (i >>> 24); res[1] = (byte) ((i >>> 16) & 0xFF); res[2] = (byte) ((i >>> 8) & 0xFF); res[3] = (byte) (i & 0xFF); return res; } }