reverse Byte array - Android File Input Output

Android examples for File Input Output:Byte Array

Description

reverse Byte array

Demo Code


//package com.java2s;

public class Main {
    public static void reverseBytes(byte[] data) {
        for (int i = 0; i < data.length / 2; i++) {
            byte first = data[i];
            byte last = data[data.length - 1 - i];

            data[i] = last;/*w  w w  .jav  a 2  s .co m*/
            data[data.length - 1 - i] = first;
        }
    }
}

Related Tutorials