Here you can find the source of splitString(String s, int maxSize)
public static List<String> splitString(String s, int maxSize)
//package com.java2s; import java.util.ArrayList; import java.util.List; public class Main { public static List<String> splitString(String s, int maxSize) { List<String> linesOfMaxSize = new ArrayList<String>(); int i = 0; while (i < s.length()) { linesOfMaxSize.add(s.substring(i, Math.min(i + maxSize, s.length()))); i += maxSize;//from ww w .j a v a2 s . c om } return linesOfMaxSize; } }