Java Array Swap swapBytes(byte[] data)

Here you can find the source of swapBytes(byte[] data)

Description

swap Bytes

License

Open Source License

Declaration

public static byte[] swapBytes(byte[] data) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static byte[] swapBytes(byte[] data) {
        int totalLength = data.length;
        byte[] buffer = new byte[totalLength];

        for (int i = 0; i < totalLength; i++)
            buffer[i] = data[totalLength - 1 - i];

        return buffer;
    }/*from  w  ww. ja va 2 s  . co  m*/
}

Related

  1. swapBlocks(byte[] array, int fromA, int toA, int fromB, int toB)
  2. swapByteArray(byte[] source)
  3. swapByteOrder(byte[] a)
  4. swapByteOrder32(byte[] data, int ofs, int len)
  5. swapBytes(byte[] bytes)
  6. swapBytes(byte[] dataToSwap, int wordByteLength)
  7. swapBytesAt(byte[] bytes, int p1, int p2)
  8. swapElements(final E[] arr, final int idx1, final int idx2)
  9. swapEndianFormat(byte[] b)