百度麻将第二题,这样做有问题吗?public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); // 注意 hasNext 和 hasNextLine 的区别 while (in.hasNext()) { // 注意 while 处理多个 case String str = in.nextLine(); System.out.println(rotateStr(str)); } } public static String rotateStr(String str) { char[] charArray = str.toCharArray(); Boolean[] bs = new Boolean[charArray.length]; Arrays.fill(bs, false); int g = 2; LinkedList<Character> list = new LinkedList<>(); for (int i = 1; i < bs.length; i+=2) { list.add(charArray[i]); bs[i] = true; } while (list.size() != charArray.length) { g = 2 * g; int start = 0; for (int i = 0; i < bs.length; i++) { if (!bs[i]){ start = i; break; } } for (int i = start; i < charArray.length; i+=g) { list.add(charArray[i]); bs[i] = true; } } StringBuilder sb = new StringBuilder(); for (Character c : list) { sb.append(c); } return sb.toString(); }}