Java Array Swap swapByteOrder(byte[] a)

Here you can find the source of swapByteOrder(byte[] a)

Description

swap Byte Order

License

Open Source License

Declaration

public static void swapByteOrder(byte[] a) 

Method Source Code

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

public class Main {
    public static void swapByteOrder(byte[] a) {
        for (int i = 0; i < a.length / 2; i++) {
            byte tmp = a[i];
            a[i] = a[a.length - 1 - i];// ww  w  . j  av  a 2 s . c  om
            a[a.length - 1 - i] = tmp;
        }
    }
}

Related

  1. swapArray(int[] v, int i, int j)
  2. swapArrayStr(String[] arr)
  3. swapArrayValues(int i1, int i2, int[] indices)
  4. swapBlocks(byte[] array, int fromA, int toA, int fromB, int toB)
  5. swapByteArray(byte[] source)
  6. swapByteOrder32(byte[] data, int ofs, int len)
  7. swapBytes(byte[] bytes)
  8. swapBytes(byte[] data)
  9. swapBytes(byte[] dataToSwap, int wordByteLength)