Had my "whaaat?" moment of the day when I wrote some experimental Java code and did some performance analysis against the conventional method. Working on a code where I need to split a String in first and last name and had to trim those to 15 characters. Without further stories, will post the code directly. int lastSpaceCharacterLocation = customerName.lastIndexOf(" "); String firstName = StringUtils.substring(StringUtils.substring(customerName, 0, lastSpaceCharacterLocation), 0, 15); String lasttName = StringUtils.substring(StringUtils.substring(customerName, lastSpaceCharacterLocation + 1), 0, 15); I chose this over the conventional method of String[] aa = customerName.split(" "); StringUtils.substring(aa[0], 0, 15); StringUtils.substring(aa[aa.length - 1], 0, 15); To my surprise the first method was around 6 times faster than conventional one! How did I compare performance? I know I am not a per specialist, but here's how I did it: package com.test; import org.apache.commons.lang.StringUtils; /** * Created by IntelliJ IDEA. User: sumit.goyal Date: 2/2/12 Time: 3:25 PM To change this template * use File | Settings | File Templates. */ public class StringPerfTest { public static void main(String[] args) { String customerName = "SumitSumitSumitasdfadsf SumitSumitSumitsadssss"; final long start1 = System.currentTimeMillis(); System.out.println(start1); for (long i = 0; i < 10000000; i++) { int lastSpaceCharacterLocation = customerName.lastIndexOf(" "); StringUtils .substring(StringUtils.substring(customerName, 0, lastSpaceCharacterLocation), 0, 15); StringUtils .substring(StringUtils.substring(customerName, lastSpaceCharacterLocation + 1), 0, 15); } final long stop1 = System.currentTimeMillis(); System.out.println(stop1); final long start2 = System.currentTimeMillis(); System.out.println(start2); for (long i = 0; i < 10000000; i++) { String[] aa = customerName.split(" "); StringUtils.substring(aa[0], 0, 15); StringUtils.substring(aa[aa.length - 1], 0, 15); } final long stop2 = System.currentTimeMillis(); System.out.println(stop2); System.out.println(stop1 - start1); System.out.println(stop2 - start2); } }