public static String[] split(String src,char delim,int limit){
  final ArrayList<String> output=new ArrayList<>();
  int index;
  int lindex=0;
  final boolean limited=limit > 0;
  while ((index=src.indexOf(delim,lindex)) != -1 && (!limited || output.size() < limit - 1)) {
    output.add(src.substring(lindex,index));
    lindex=index + 1;
  }
  output.add(src.substring(lindex));
  return output.toArray(new String[output.size()]);
}

public static String [ ] split ( String src , char delim , int limit ) { final ArrayList < String > output = new ArrayList < > ( ) ; int index ; int lindex = 0 ; final boolean limited = limit > 0 ; while ( ( index = src . indexOf ( delim , lindex ) ) != - 1 && ( ! limited || output . size ( ) < limit - 1 ) ) { output . add ( src . substring ( lindex , index ) ) ; lindex = index + 1 ; } output . add ( src . substring ( lindex ) ) ; return output . toArray ( new String [ output . size ( ) ] ) ; }
faster implementation of string splitting on a single character delimiter .
