Java Byte Array Equal bytesEqual(byte[] buf1, byte[] buf2, int off, int len)

Here you can find the source of bytesEqual(byte[] buf1, byte[] buf2, int off, int len)

Description

bytes Equal

License

Apache License

Declaration

public static boolean bytesEqual(byte[] buf1, byte[] buf2, int off,
            int len) 

Method Source Code

//package com.java2s;
//   Licensed under the Apache License, Version 2.0 (the "License");

public class Main {
    public static boolean bytesEqual(byte[] buf1, byte[] buf2, int off,
            int len) {
        for (int i = off; i < off + len; i++) {
            if (i >= buf1.length || i >= buf2.length) {
                return false;
            }//from   ww  w  .  j a v a2s  .  c  o  m
            if (buf1[i] != buf2[i]) {
                return false;
            }
        }
        return true;
    }
}

Related

  1. bytesEqual(byte[] a, byte[] b, int len)
  2. bytesEqual(byte[] a, int aFrom, int aLen, byte[] b, int bFrom, int bLen)
  3. bytesEqual(byte[] a, int aOff, byte[] b, int bOff, int len)
  4. bytesEqual(byte[] a1, byte[] a2)
  5. bytesEqual(byte[] a1, byte[] a2)
  6. bytesEqual(final byte[] a, final byte[] b)
  7. bytesEqual(final byte[] b1, final int j, final byte[] b2, final int k, final int len)
  8. bytesEqual(final byte[] source, final int offset, final byte[] target)