Here you can find the source of flipEndian(byte[] original, byte[] output)
Parameter | Description |
---|---|
original | input array to reverse (does not get changed) |
output | output array for results of byte order reversal. |
public static final void flipEndian(byte[] original, byte[] output)
//package com.java2s; /******************************************************************************* * SimpleWAVIO - A straightforward library for loading and saving .WAV (RIFF) files as numerical arrays. * Copyright (C) 2012,2013 Chuck Ritola * // www . j av a 2s .co m * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 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 General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. ******************************************************************************/ public class Main { /** * Reverse the order of a byte array and write that reordered array to the given output. Intra-byte bit order is unchanged. * @param original input array to reverse (does not get changed) * @param output output array for results of byte order reversal. * @since Jul 14, 2012 */ public static final void flipEndian(byte[] original, byte[] output) { for (int i = 0; i < original.length; i++) { output[(original.length - 1) - i] = original[i]; } } }