Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Program {
- public static int[] rototto ( int [] arr, int k ) {
- int [] arr_r = new int [ arr.length ];
- for ( int i = 0; i < arr.length; i++ )
- arr_r [ i ] = arr [ (i + k) % arr.length ];
- return arr_r;
- }
- public static void main(String[] args) {
- int [] arr = { 1,2,3,4,5,6,7,8 };
- arr = rototto ( arr, 3 );
- for ( int x:arr ) {
- System.out.print(x + " ");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement