Here you can find the source of endsWith(String s1, String s2)
public static boolean endsWith(String s1, String s2)
//package com.java2s; //License from project: Open Source License public class Main { public static boolean endsWith(String s1, String s2) { if (s1 == null) { if (s2 == null) { return true; } else { // return s2.endsWith(s1); return false; }/*from w w w . j a v a 2 s. co m*/ } else { if (s2 == null) { return false; } else { return s1.endsWith(s2); } } } }