Here you can find the source of splitIntoPairs(String subDirName)
private static List<String> splitIntoPairs(String subDirName)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.List; public class Main { /**/* w w w. ja v a 2 s. c o m*/ * splits the given subDirName into pairs of characters (odd length results in exception) */ private static List<String> splitIntoPairs(String subDirName) { if (subDirName.length() % 2 == 1) { throw new IllegalArgumentException("subDirName contains an odd number of characters"); } else { List<String> ret = new ArrayList<>(); int i = 0; while (i < subDirName.length()) { ret.add(subDirName.substring(i, i + 2)); i = i + 2; } return ret; } } }