Here you can find the source of copyBytes(byte[] results, int offset, int int32)
public static void copyBytes(byte[] results, int offset, int int32)
//package com.java2s; /* Copyright (C) 2011 Marius C. Silaghi Author: Marius Silaghi: msilaghi@fit.edu Florida Tech, Human Decision Support Systems Laboratory //from w w w .j ava2 s.com This program is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation; either the current version of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ public class Main { public static void copyBytes(byte[] results, int offset, int int32) { //System.err.println("will copy bytes off "+offset); byte[] src = new byte[4]; src[0] = (byte) (int32 & 0xff); src[1] = (byte) ((int32 >> 8) & 0xff); src[2] = (byte) ((int32 >> 16) & 0xff); src[3] = (byte) ((int32 >> 24) & 0xff); copyBytes(results, offset, src, 4, 0); } public static void copyBytes(byte[] results, int offset, short int16) { byte[] src = new byte[2]; src[0] = (byte) (int16 & 0xff); src[1] = (byte) ((int16 >> 8) & 0xff); copyBytes(results, offset, src, 2, 0); } public static void copyBytes(byte[] results, int offset, byte[] src, int length) { copyBytes(results, offset, src, length, 0); } public static void copyBytes(byte[] results, int offset, byte[] src, int length, int src_offset) { if (results.length < length + offset) System.err.println("Destination too short: " + results.length + " vs " + offset + "+" + length); if (src.length < length + src_offset) System.err.println("Source too short: " + src.length + " vs " + src_offset + "+" + length); for (int k = 0; k < length; k++) { results[k + offset] = src[src_offset + k]; } } }