Java tutorial
//package com.java2s; public class Main { private static int getStartIndex(CharSequence input) { int length = input.length(); int index = 0; while (Character.isWhitespace(input.charAt(index))) { ++index; if (index >= length) { break; } } return index; } }