Here you can find the source of toByteBE(int value, byte[] dst, int offset)
public static final int toByteBE(int value, byte[] dst, int offset)
//package com.java2s; /******************************************************************************* * Copyright (c) 2013 Jens Kristian Villadsen. * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Public License v3.0 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/gpl.html/*from ww w . ja v a 2 s . c o m*/ * * Contributors: * Jens Kristian Villadsen - Lead developer, owner and creator ******************************************************************************/ public class Main { /** * int to 32bit */ public static final int toByteBE(int value, byte[] dst, int offset) { dst[offset] = (byte) ((value >> 24) & 0xFF); dst[++offset] = (byte) ((value >> 16) & 0xFF); dst[++offset] = (byte) ((value >> 8) & 0xFF); dst[++offset] = (byte) (value & 0xFF); return 4; } }