Here you can find the source of split(String str)
public static String[] split(String str)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static String[] split(String str) { ArrayList<String> list = new ArrayList<>(); int s = 0, n = str.length(); for (;;) { while (s < n && Character.isWhitespace(str.charAt(s))) s++;// ww w . j a v a 2s . c o m if (s == n) break; int t = s; while (t < n && !Character.isWhitespace(str.charAt(t))) t++; list.add(str.substring(s, t)); s = t; } return list.toArray(new String[0]); } }