Here you can find the source of breakString(String input, int partLength)
public static String[] breakString(String input, int partLength)
//package com.java2s; //License from project: Apache License public class Main { public static String[] breakString(String input, int partLength) { int numParts = input.length() / partLength; if (input.length() % partLength > 0) numParts++;//from w ww .j av a 2s.c om String[] parts = new String[numParts]; int startIndex, endIndex; for (int i = 0; i < numParts; i++) { startIndex = i * partLength; endIndex = startIndex + partLength; if (endIndex > input.length()) { endIndex = input.length(); } parts[i] = input.substring(i * partLength, endIndex); } return parts; } }