Here you can find the source of endsWith(StringBuffer buf, String s)
public static boolean endsWith(StringBuffer buf, String s)
//package com.java2s; public class Main { public static boolean endsWith(StringBuffer buf, String s) { int iBuf = buf.length(); int iS = s.length(); while (--iS >= 0 && --iBuf >= 0 && buf.charAt(iBuf) == s.charAt(iS)) { }/* www .j a va2 s. c o m*/ return iS < 0; } }