Here you can find the source of endsWith(String s, String end)
public static boolean endsWith(String s, String end)
//package com.java2s; public class Main { public static boolean endsWith(String s, char end) { return endsWith(s, (new Character(end)).toString()); }/*from w ww . j a v a2 s. co m*/ public static boolean endsWith(String s, String end) { if ((s == null) || (end == null)) { return false; } if (end.length() > s.length()) { return false; } String temp = s.substring(s.length() - end.length(), s.length()); if (temp.equalsIgnoreCase(end)) { return true; } else { return false; } } }