Add reverseInPlace variant
@@ -1090,6 +1090,17 @@ private static int getLength(int from, int to)
return a;
}
+ public static void reverseInPlace(byte[] a, int aOff, int aLen)
+ {
+ int p1 = aOff, p2 = aOff + aLen - 1;
+ while (p1 < p2)
+ {
+ byte t1 = a[p1], t2 = a[p2];
+ a[p1++] = t2;
+ a[p2--] = t1;
+ }
+ }
+
public static int[] reverseInPlace(int[] a)
{
if (null == a)
