Here you can find the source of endsWith(String str, String mark)
private static boolean endsWith(String str, String mark)
//package com.java2s; //License from project: Apache License public class Main { private static boolean endsWith(String str, String mark) { return startsWith(str, mark, str.length() - mark.length()); }/*from w w w .ja v a 2s. co m*/ private static boolean startsWith(String str, String mark, int paramInt) { char[] value = str.toCharArray(); if ((paramInt < 0) || paramInt > value.length) { return false; } int k = mark.length(); char[] chars = mark.toCharArray(); while (--k >= 0) { if (value[paramInt + k] != chars[k]) { return false; } } return true; } }