Here you can find the source of writeIntArray(ByteBuffer buf, int[] arr)
public static void writeIntArray(ByteBuffer buf, int[] arr)
//package com.java2s; /******************************************************************************* * Copyright (c) 2013 Vladimir Rodionov. All Rights Reserved * * This code is released under the GNU Affero General Public License. * * See: http://www.fsf.org/licensing/licenses/agpl-3.0.html * * VLADIMIR RODIONOV MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY * OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR * NON-INFRINGEMENT. Vladimir Rodionov SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED * BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR * ITS DERIVATIVES.//from w ww .jav a 2s .c o m * * Author: Vladimir Rodionov * *******************************************************************************/ import java.nio.ByteBuffer; public class Main { public static void writeIntArray(ByteBuffer buf, int[] arr) { final int size = arr.length; buf.putInt(size); for (int i = 0; i < size; i++) { buf.putInt(arr[i]); } } }