Java Array Length Get lengthToZero(byte[] data, int offset)

Here you can find the source of lengthToZero(byte[] data, int offset)

Description

length To Zero

License

Open Source License

Declaration

public static int lengthToZero(byte[] data, int offset) 

Method Source Code

//package com.java2s;

public class Main {
    public static int lengthToZero(byte[] data, int offset) {
        int start = offset;
        for (int i = start; i < data.length; i++) {
            if (data[i] == 0) {
                return (i - start);
            }/*from  w w  w. j a v a 2  s. co  m*/
        }
        int remaining = data.length - start;
        return remaining > 0 ? remaining : 0;
    }
}

Related

  1. lengthNeeded(byte[] b)
  2. lengthOf(T[] array)
  3. lengthOfShortestIn(String[] strings)
  4. lengthSQ(double[] vector)
  5. lengthToWrite(final byte[] data, final int offset, final int dataLength, final boolean rightTrim)
  6. LengthVec3D(double[] vec)