Here you can find the source of swapOrder16(byte[] buffer, int byteOffset, int sampleCount)
public static void swapOrder16(byte[] buffer, int byteOffset, int sampleCount)
//package com.java2s; public class Main { public static void swapOrder16(byte[] buffer, int byteOffset, int sampleCount) { int byteMax = sampleCount * 2 + byteOffset - 1; int i = byteOffset; while (i < byteMax) { byte h = buffer[i]; buffer[i] = buffer[++i];//from www .ja v a2 s . co m buffer[i++] = h; } } public static void swapOrder16(byte[] inBuffer, int inByteOffset, byte[] outBuffer, int outByteOffset, int sampleCount) { while (sampleCount > 0) { outBuffer[outByteOffset++] = inBuffer[inByteOffset + 1]; outBuffer[outByteOffset++] = inBuffer[inByteOffset++]; inByteOffset++; sampleCount--; } } }