code: public static String[] permutation(int length, char... arr) {
          if (arr == null || arr.length == 0 || length <= 0 || length > arr.length) {
              return null;
          }
          List<String> slist = new ArrayList<String>();
          char[] b = new char[length]; // 辅助空间，保存待输出组合数
          getCombination(slist, arr, length, 0, b, 0);
          return slist.toArray(new String[]{});
      }
docs: 按照指定长度, 获得字符数组的全排列
  
  @param arr
  字符数组
  @return 全排列