Here you can find the source of split(final int limit, String text)
public static ArrayList<String> split(final int limit, String text)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; public class Main { public static ArrayList<String> split(final int limit, String text) { final ArrayList<String> splits = new ArrayList<String>(); if (text.length() > limit) { while (text.length() > limit) { final String sub = text.substring(0, limit); final int lastSpace = sub.lastIndexOf(" "); text = text.substring(lastSpace + 1); splits.add(sub);/*from www. j ava2 s . com*/ } return splits; } splits.add(text); return splits; } }