Android FloatBuffer Copy copyInternal(final FloatBuffer buf, final int fromPos, final int toPos, final int length)

Here you can find the source of copyInternal(final FloatBuffer buf, final int fromPos, final int toPos, final int length)

Description

Copies floats from one position in the buffer to another.

Parameter

Parameter Description
buf the buffer to copy from/to
fromPos the starting point to copy from
toPos the starting point to copy to
length the number of floats to copy

Declaration

public static void copyInternal(final FloatBuffer buf,
        final int fromPos, final int toPos, final int length) 

Method Source Code

//package com.java2s;

import java.nio.FloatBuffer;

public class Main {
    /**//  www.j a  v  a 2  s.  c o m
     * Copies floats from one position in the buffer to another.
     * 
     * @param buf
     *            the buffer to copy from/to
     * @param fromPos
     *            the starting point to copy from
     * @param toPos
     *            the starting point to copy to
     * @param length
     *            the number of floats to copy
     */
    public static void copyInternal(final FloatBuffer buf,
            final int fromPos, final int toPos, final int length) {
        final float[] data = new float[length];
        buf.position(fromPos);
        buf.get(data);
        buf.position(toPos);
        buf.put(data);
    }
}

Related

  1. copyFloatBuffer(FloatBuffer paramFloatBuffer)
  2. copyInternalVector3(final FloatBuffer buf, final int fromPos, final int toPos)