java how to get the last digit in number

java how to get the last digit in number
/**
 * @author lautturi.com
 * Java example: java how to get the last digit in number 
 */

import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Lautturi {
	
	public static void main(String[] args)   {

		String number = "1234";
		String regexString = "(.*)(\\d)";
		Pattern pattern = Pattern.compile(regexString);
		
		String lastDigit = "";
		Matcher matcher = pattern.matcher(number);
		if (matcher.find()) {
            matcher.reset();
            if (matcher.find()) {
            	lastDigit = matcher.group(2);
            }
		}
		System.out.println(lastDigit);

	}
	
}
Source‮ual.www:‬tturi.com

output:

4
Created Time:2017-09-11 16:36:03  Author:lautturi