src/test/java/pityoulish/sockets/server/TLVResponseBuilderImplTest.java
public static int count(byte[] data, byte value)
  {
    if (data == null)
       return 0;

    int c = 0;
    for (byte b: data)
       if (b == value)
          c++;

    return c;
  }
/**
   * Counts how often a byte occurs in an array.
   * Since Hamcrest matchers don't work well on byte arrays,
   * let's use this workaround.
   *
   * @param data        the array to consider
   * @param value       the element to look for
   *
   * @return    number of times the value occurs in the data
   */
Counts how often a byte occurs in an array.
Since Hamcrest matchers don't work well on byte arrays,
let's use this workaround.

@param data        the array to consider
@param value       the element to look for

@return    number of times the value occurs in the data
Counts how often a byte occurs in an array . Since Hamcrest matchers don ' t work well on byte arrays let ' s use this workaround . @param data the array to consider @param value the element to look for @return number of times the value occurs in the data
public static int count(byte[] data, byte value)
  {
    if (data == null)
       return 0;
    int c = 0;
    for (byte b: data)
       if (b == value)
          c++;
    return c;
  }
public static int count ( byte [ ] data , byte value ) { if ( data == null ) return 0 ; int c = 0 ; for ( byte b : data ) if ( b == value ) c ++ ; return c ; }
Counts how often a byte occurs in an array.
Counts how often a byte occurs in an array .