标签:blog nbsp div 数组 pre i++ index 位移 dex
public void reindexArray(int[] arr, int step) { int len = arr.length; int s = step % len; int[] a = new int[len]; for (int i = 0; i < len; i++) { if(i+s<arr.length){ a[i+s] = arr[i]; }else{ a[i+s-len] = arr[i]; } } for (int i : a) { System.out.println(i); } }
标签:blog nbsp div 数组 pre i++ index 位移 dex
原文地址:http://www.cnblogs.com/clarke157/p/6806456.html