Java String Ends With endsWith(byte[] subject, byte[] suffix)

Here you can find the source of endsWith(byte[] subject, byte[] suffix)

Description

Returns true if subject ends with suffix .

License

Open Source License

Declaration

private static boolean endsWith(byte[] subject, byte[] suffix) 

Method Source Code

//package com.java2s;

public class Main {
    /**/*from w w w.  j  a  va  2s.  co  m*/
     * Returns {@code true} if {@code subject} ends with {@code suffix}.
     */
    private static boolean endsWith(byte[] subject, byte[] suffix) {
        int start = subject.length - suffix.length;
        if (start < 0) {
            return false;
        }
        for (int i = start; i < subject.length; i++) {
            if (subject[i] != suffix[i - start]) {
                return false;
            }
        }
        return true;
    }
}

Related

  1. endsWith(byte[] bytes, String str)
  2. endsWith(byte[] dataFrom, String suffix)
  3. endsWith(byte[] source, char c)
  4. endsWith(char s[], int len, char suffix[])
  5. endsWith(char[] fieldDescriptor, char c)
  6. endsWith(CharSequence cs, CharSequence suffix)
  7. endsWith(CharSequence cs, String postfix)