Here you can find the source of reverse(byte[] original)
Parameter | Description |
---|---|
original | a parameter |
public static byte[] reverse(byte[] original)
//package com.java2s; public class Main { /**//from ww w . j a v a 2 s. c om * * @param original * @return */ public static byte[] reverse(byte[] original) { byte[] result = new byte[original.length]; final int stop = original.length >> 1; byte x, y; for (int i = 0; i < stop; i++) { x = original[i]; y = original[original.length - i - 1]; if (0 != (x ^ y)) { x ^= y; y ^= x; x ^= y; } result[i] = x; result[original.length - i - 1] = y; } if (1 == original.length % 2) { result[stop] = original[stop]; } return result; } }