@Test public void testGetParts() { String s = "abcdefg"; List<String> parts = Splitter.getParts(s, 3); assertEquals(parts.get(0), "abc"); assertEquals(parts.get(1), "def"); assertEquals(parts.get(2), "g"); }
public static List<String> getParts(String string, int partitionSize) { List<String> parts = new ArrayList<String>(); int len = string.length(); for (int i = 0; i < len; i += partitionSize) { parts.add(string.substring(i, Math.min(len, i + partitionSize))); } return parts; }
Splitter { public static List<String> getParts(String string, int partitionSize) { List<String> parts = new ArrayList<String>(); int len = string.length(); for (int i = 0; i < len; i += partitionSize) { parts.add(string.substring(i, Math.min(len, i + partitionSize))); } return parts; } }
Splitter { public static List<String> getParts(String string, int partitionSize) { List<String> parts = new ArrayList<String>(); int len = string.length(); for (int i = 0; i < len; i += partitionSize) { parts.add(string.substring(i, Math.min(len, i + partitionSize))); } return parts; }  }
Splitter { public static List<String> getParts(String string, int partitionSize) { List<String> parts = new ArrayList<String>(); int len = string.length(); for (int i = 0; i < len; i += partitionSize) { parts.add(string.substring(i, Math.min(len, i + partitionSize))); } return parts; }  static List<String> getParts(String string, int partitionSize); }
Splitter { public static List<String> getParts(String string, int partitionSize) { List<String> parts = new ArrayList<String>(); int len = string.length(); for (int i = 0; i < len; i += partitionSize) { parts.add(string.substring(i, Math.min(len, i + partitionSize))); } return parts; }  static List<String> getParts(String string, int partitionSize);  }