Here you can find the source of strSplit(String src, int firstLineLength, int otherLineLength)
private static List<String> strSplit(String src, int firstLineLength, int otherLineLength)
//package com.java2s; //License from project: Open Source License import java.util.*; import java.util.List; public class Main { private static List<String> strSplit(String src, int firstLineLength, int otherLineLength) { List<String> result = new ArrayList<>(); String subStr = null;//from ww w . j ava 2 s . c o m if (firstLineLength < src.length()) { subStr = src.substring(0, firstLineLength); result.add(subStr); for (int i = firstLineLength; i < src.length(); i += otherLineLength) { if (i + otherLineLength > src.length()) { subStr = src.substring(i, src.length()); } else { subStr = src.substring(i, i + otherLineLength); } result.add(subStr); } } else { subStr = src.substring(0, src.length()); result.add(subStr); } return result; } }