Here you can find the source of getSecondName(String names)
public static String getSecondName(String names) throws Exception
//package com.java2s; //License from project: LGPL public class Main { public static String getSecondName(String names) throws Exception { if (names == null) { throw new Exception("Names cannot be null"); }/*from w w w. j a v a2s . c o m*/ // remove leading and trailing whitespace String temp = names.trim(); if (temp.contains(" ")) { return temp.substring(temp.indexOf(" ")).trim(); } return temp; } }