Here you can find the source of chop(String value, int size)
public static final String[] chop(String value, int size)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from w w w .ja v a 2 s . co m*/ * CHOP */ public static final String[] chop(String value, int size) { int fullParts = value.length() / size; int extra = ((value.length() % size) != 0) ? 1 : 0; String[] part = new String[fullParts + extra]; for (int i = 0; i < fullParts; i++) part[i] = value.substring(i * size, (i + 1) * size); if (extra != 0) part[fullParts] = value.substring(fullParts * size); return part; } }