Android Byte Array Rotate rotateRight(byte[] input)

Here you can find the source of rotateRight(byte[] input)

Description

Moves all bytes one down, meaning the right most byte (length-1) is swapped to the beginning

Declaration

public static byte[] rotateRight(byte[] input) 

Method Source Code

//package com.java2s;

public class Main {
    /**// w w w .  ja  v  a 2  s.c  om
     * Moves all bytes one down, meaning the right most byte (length-1) is swapped to the beginning
     */
    public static byte[] rotateRight(byte[] input) {
        byte[] cycled = new byte[input.length];
        System.arraycopy(input, 0, cycled, 1, input.length - 1);
        cycled[0] = input[input.length - 1];
        return cycled;
    }
}

Related

  1. rotateLeft(byte[] input)
  2. unrotate(byte[] data, int blockSizeBytes)