package com.loveCoding.homework.j20250517_method;

/**
 * @author WanJl
 * @version 1.0
 * @title T13
 * @description
 * **13. 数组右移k位**
 * 要求：将数组元素向右循环移动k个位置
 * 示例输入：`{1,2,3,4,5}`，k=2
 * 示例输出：`4,5,1,2,3`（右移2位后结果）
 * @create 2025/5/24
 */
public class T13 {
    public static void main(String[] args) {
        int[] arr={1,2,3,4,5,6,7,8,9,10};
        int k=5;
        int[] tArr=new int[arr.length];
        for (int i = 0; i < arr.length-k; i++) {
            tArr[i+k]=arr[i];
        }
        for (int i = 0; i < k; i++) {
            tArr[i]=arr[arr.length-k+i];
        }
        for (int i = 0; i < tArr.length; i++) {
            System.out.print(tArr[i]+" ");
        }
    }
}
