Finds the number of nodes to relocate in order to achieve a given code
length limit
@param array The code length array
@param maximumLength The maximum bit length for the generated codes
@return The number of nodes to relocate
160622
function(array, maximumLength) {
    var currentNode = array.length - 2;
    var currentDepth;
    for (currentDepth = 1;
         (currentDepth < (maximumLength - 1)) && (currentNode > 1);
         currentDepth++) {
      currentNode =  first (array, currentNode - 1, 0);
    }

    return currentNode;
  }
1041827
public String randomLowerMaxLength(int minLength, int maxLength) {
        int range = maxLength - minLength;
        int randomLength = 0;
        if (range > 0) {
            randomLength = random(range);
        }
        return randomLower(minLength + randomLength);
    }
486723
public function setMaxlength($maxlength)
    {
        if (empty((int) $maxlength)) {
            Throw new HtmlException('A html form textareas maxlength attribute needs to be of type integer.');
        }

        $this->attribute['maxlength'] = $maxlength;

        return $this;
    }
577565
private static int actualArrayLength(int recommended) {
    if (recommended > MAX_ARRAY_LENGTH) {
      return MAX_ARRAY_LENGTH;
    } else if (recommended < MIN_ARRAY_LENGTH) {
      return MIN_ARRAY_LENGTH;
    } else {
      final int a = Integer.highestOneBit(recommended);
      return a == recommended? a: a << 1;
    }
  }
165183
private function maxLength()
	{
		$max = mb_strlen($this->value);
		if (!$ret = $max <= $this->options->max) {
			$this->error(1);
		}

		return $ret;
	}
1058752
protected function getNextLineFromSourceConnection($maxLength = null)
    {
        if ($maxLength !== null) {
            return fgets($this->sourceConnection, $maxLength);
        } else {
            return fgets($this->sourceConnection);
        }
    }
1277927
public static int lineEnd(ByteBuffer buffer, int maxLength) {
		int primitivePosition = buffer.position();
		boolean canEnd = false;
		int charIndex = primitivePosition;
		byte b;
		while (buffer.hasRemaining()) {
			b = buffer.get();
			charIndex++;
			if (b == StrUtil.C_CR) {
				canEnd = true;
			} else if (b == StrUtil.C_LF) {
				return canEnd ? charIndex - 2 : charIndex - 1;
			} else {
				// 只有\r无法确认换行
				canEnd = false;
			}

			if (charIndex - primitivePosition > maxLength) {
				// 查找到尽头，未找到，还原位置
				buffer.position(primitivePosition);
				throw new IndexOutOfBoundsException(StrUtil.format("Position is out of maxLength: {}", maxLength));
			}
		}

		// 查找到buffer尽头，未找到，还原位置
		buffer.position(primitivePosition);
		// 读到结束位置
		return -1;
	}
1133300
function maxlength (val, max) {
  if (typeof val === 'string') {
    return isInteger(max, 10) && val.length <= parseInt(max, 10)
  } else if (Array.isArray(val)) {
    return val.length <= parseInt(max, 10)
  } else {
    return false
  }
}
221820
private static int maxLength(List<String> coll) {
		int max = 0;
		for (String e : coll) {
			int length = e.length();
			if (length > max) {
				max = length;
			}
		}
		return max;
	}
578164
public int getMaxLength() 
    { // Survey the first few to get the max length (Only called when setting up screen field)
        String string;
        int maxLength = 1;
        for (int index = 0; index < 10; index++)
        {
            string = this.getNextConverter().convertIndexToDisStr(index);
            if (index > 0) if (string.length() == 0)
                break;      // Far Enough
            if (string.length() > (short)maxLength)
                maxLength = string.length();
        }
        return maxLength;
    }
700353
public static function getMaxLength($array, $key) {
        $maxLen = 0;
        foreach ($array as $element) {
            $str = call_user_func(array($element, $key));
            $maxLen = strlen($str) > $maxLen ? strlen($str) : $maxLen;
        }
        return $maxLen;
    }
774391
public static function maxStrlen(array $string)
    {
        $length = 0;
        foreach ($string as $str) {
            if (strlen($str) > $length) {
                $length = strlen($str);
            }
        }

        return $length;
    }
265021
public void setCodeLength(short codeLength) {
        this.codeLength = codeLength;
        if (codes.size() < codeLength) {
            for (int i = 0; i < codeLength; i++)
                codes.add((byte) 0);
        }

        if (points.size() < codeLength) {
            for (int i = 0; i < codeLength; i++)
                points.add(0);
        }
    }


    public static final long getLongHash(@NonNull String string) {
        return HashUtil.getLongHash(string);
    }

    /**
     * Returns gradient for this specific element, at specific position
     * @param index
     * @param g
     * @param lr
     * @return
     */
    @Deprecated
    public double getGradient(int index, double g, double lr) {
        /*
        if (adaGrad == null)
            adaGrad = new AdaGrad(1,getCodeLength(), lr);
        
        return adaGrad.getGradient(g, index, new int[]{1, getCodeLength()});
        */
        return 0.0;
    }
658928
public static long max(long... numberArray) {
		if (isEmpty(numberArray)) {
			throw new IllegalArgumentException("Number array must not empty !");
		}
		long max = numberArray[0];
		for (int i = 0; i < numberArray.length; i++) {
			if (max < numberArray[i]) {
				max = numberArray[i];
			}
		}
		return max;
	}
732586
public void writeFieldLength(long length) throws IOException {
    if (length < 251) {

      write((byte) length);

    } else if (length < 65536) {

      if (3 > buf.length - pos) {
        //not enough space remaining
        byte[] arr = new byte[3];
        arr[0] = (byte) 0xfc;
        arr[1] = (byte) length;
        arr[2] = (byte) (length >>> 8);
        write(arr, 0, 3);
        return;
      }

      buf[pos] = (byte) 0xfc;
      buf[pos + 1] = (byte) length;
      buf[pos + 2] = (byte) (length >>> 8);
      pos += 3;

    } else if (length < 16777216) {

      if (4 > buf.length - pos) {
        //not enough space remaining
        byte[] arr = new byte[4];
        arr[0] = (byte) 0xfd;
        arr[1] = (byte) length;
        arr[2] = (byte) (length >>> 8);
        arr[3] = (byte) (length >>> 16);
        write(arr, 0, 4);
        return;
      }

      buf[pos] = (byte) 0xfd;
      buf[pos + 1] = (byte) length;
      buf[pos + 2] = (byte) (length >>> 8);
      buf[pos + 3] = (byte) (length >>> 16);
      pos += 4;

    } else {

      if (9 > buf.length - pos) {
        //not enough space remaining
        byte[] arr = new byte[9];
        arr[0] = (byte) 0xfe;
        arr[1] = (byte) length;
        arr[2] = (byte) (length >>> 8);
        arr[3] = (byte) (length >>> 16);
        arr[4] = (byte) (length >>> 24);
        arr[5] = (byte) (length >>> 32);
        arr[6] = (byte) (length >>> 40);
        arr[7] = (byte) (length >>> 48);
        arr[8] = (byte) (length >>> 54);
        write(arr, 0, 9);
        return;
      }

      buf[pos] = (byte) 0xfe;
      buf[pos + 1] = (byte) length;
      buf[pos + 2] = (byte) (length >>> 8);
      buf[pos + 3] = (byte) (length >>> 16);
      buf[pos + 4] = (byte) (length >>> 24);
      buf[pos + 5] = (byte) (length >>> 32);
      buf[pos + 6] = (byte) (length >>> 40);
      buf[pos + 7] = (byte) (length >>> 48);
      buf[pos + 8] = (byte) (length >>> 54);
      pos += 9;

    }
  }
326696
public function setMaxLineLength(int $maxLineLength): Message
    {
        // Each line of characters MUST be no more than 998 characters,
        // and SHOULD be no more than 78 characters, excluding the CRLF.
        // https://tools.ietf.org/html/rfc5322#section-2.1.1
        $maxLineLength = (int) abs($maxLineLength);

        if ($maxLineLength > 998) {
            $maxLineLength = 998;
        }

        $this->maxLineLength = $maxLineLength;

        return $this;
    }
576349
public static void positionToLimit(WsByteBuffer buffers[]) {
        // Verify buffers are not null.
        if (buffers != null) {
            // Loop through each buffer in the array.
            for (int i = 0; i < buffers.length; i++) {
                // Verify each buffer in the array is not null.
                if (buffers[i] != null) {
                    // Shift the position to the limit.
                    buffers[i].position(buffers[i].limit());
                }
            }
        }
    }