Here you can find the source of endsWith(final CharSequence a, final CharSequence b)
public static boolean endsWith(final CharSequence a, final CharSequence b)
//package com.java2s; //License from project: Open Source License public class Main { public static boolean endsWith(final CharSequence a, final CharSequence b) { final int len = b.length(); final int off = len - a.length(); if (off < 0) { return false; }/* www.j a va2s .com*/ for (int i = 0; i < len; i++) { if (a.charAt(off + i) != b.charAt(i)) { return false; } } return true; } }