blob: fc5f67273020d468f7862dd322e806854933e06b [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_302) on Wed Jan 26 15:15:50 PST 2022 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Util (datasketches-java 3.1.0 API)</title>
<meta name="date" content="2022-01-26">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Util (datasketches-java 3.1.0 API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":9,"i1":9,"i2":9,"i3":9,"i4":9,"i5":9,"i6":9,"i7":9,"i8":9,"i9":9,"i10":9,"i11":9,"i12":9,"i13":9,"i14":9,"i15":9,"i16":9,"i17":9,"i18":9,"i19":9,"i20":9,"i21":9,"i22":9,"i23":9,"i24":9,"i25":9,"i26":9,"i27":9,"i28":9,"i29":9,"i30":9,"i31":9,"i32":9,"i33":9,"i34":9,"i35":9,"i36":9,"i37":9,"i38":9,"i39":9,"i40":9,"i41":9,"i42":9};
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/Util.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../org/apache/datasketches/SketchesStateException.html" title="class in org.apache.datasketches"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li>Next&nbsp;Class</li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?org/apache/datasketches/Util.html" target="_top">Frames</a></li>
<li><a href="Util.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.datasketches</div>
<h2 title="Class Util" class="title">Class Util</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li>org.apache.datasketches.Util</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public final class <span class="typeNameLabel">Util</span>
extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre>
<div class="block">Common utility functions.</div>
<dl>
<dt><span class="simpleTagLabel">Author:</span></dt>
<dd>Lee Rhodes</dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#DEFAULT_NOMINAL_ENTRIES">DEFAULT_NOMINAL_ENTRIES</a></span></code>
<div class="block">The default nominal entries is provided as a convenience for those cases where the
nominal sketch size in number of entries is not provided.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static long</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#DEFAULT_UPDATE_SEED">DEFAULT_UPDATE_SEED</a></span></code>
<div class="block">The seed 9001 used in the sketch update methods is a prime number that
was chosen very early on in experimental testing.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#iGolden">iGolden</a></span></code>
<div class="block">The inverse golden ratio as a fraction.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static long</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#iGoldenU64">iGoldenU64</a></span></code>
<div class="block">The inverse golden ratio as an unsigned long.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#LOG2">LOG2</a></span></code>
<div class="block">The natural logarithm of 2.0.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#LONG_MAX_VALUE_AS_DOUBLE">LONG_MAX_VALUE_AS_DOUBLE</a></span></code>
<div class="block">Long.MAX_VALUE as a double.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#LS">LS</a></span></code>
<div class="block">The java line separator character as a String.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#MAX_LG_NOM_LONGS">MAX_LG_NOM_LONGS</a></span></code>
<div class="block">The largest Log2 nom entries allowed: 26.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#MIN_LG_ARR_LONGS">MIN_LG_ARR_LONGS</a></span></code>
<div class="block">The smallest Log2 cache size allowed: 5.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#MIN_LG_NOM_LONGS">MIN_LG_NOM_LONGS</a></span></code>
<div class="block">The smallest Log2 nom entries allowed: 4.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#REBUILD_THRESHOLD">REBUILD_THRESHOLD</a></span></code>
<div class="block">The hash table rebuild threshold = 15.0/16.0.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#RESIZE_THRESHOLD">RESIZE_THRESHOLD</a></span></code>
<div class="block">The resize threshold = 0.5; tuned for speed.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static char</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#TAB">TAB</a></span></code>
<div class="block">The tab character</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#bytesToInt-byte:A-">bytesToInt</a></span>(byte[]&nbsp;arr)</code>
<div class="block">Returns an int extracted from a Little-Endian byte array.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>static long</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#bytesToLong-byte:A-">bytesToLong</a></span>(byte[]&nbsp;arr)</code>
<div class="block">Returns a long extracted from a Little-Endian byte array.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#bytesToString-byte:A-boolean-boolean-java.lang.String-">bytesToString</a></span>(byte[]&nbsp;arr,
boolean&nbsp;signed,
boolean&nbsp;littleEndian,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;sep)</code>
<div class="block">Returns a string view of a byte array</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#ceilingPowerOf2-int-">ceilingPowerOf2</a></span>(int&nbsp;n)</code>
<div class="block">Computes the ceiling power of 2 within the range [1, 2^30].</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>static double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#ceilingPowerOfBdouble-double-double-">ceilingPowerOfBdouble</a></span>(double&nbsp;b,
double&nbsp;n)</code>
<div class="block">Computes the ceiling power of B as a double.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#characterPad-java.lang.String-int-char-boolean-">characterPad</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;s,
int&nbsp;fieldLength,
char&nbsp;padChar,
boolean&nbsp;postpend)</code>
<div class="block">Prepend or postpend the given string with the given character to fill the given field length.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#checkBounds-long-long-long-">checkBounds</a></span>(long&nbsp;reqOff,
long&nbsp;reqLen,
long&nbsp;allocSize)</code>
<div class="block">Check the requested offset and length against the allocated size.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#checkIfMultipleOf8AndGT0-long-java.lang.String-">checkIfMultipleOf8AndGT0</a></span>(long&nbsp;v,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;argName)</code>
<div class="block">Checks if parameter v is a multiple of 8 and greater than zero.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#checkIfPowerOf2-int-java.lang.String-">checkIfPowerOf2</a></span>(int&nbsp;v,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;argName)</code>
<div class="block">Checks the given parameter to make sure it is positive, an integer-power of 2 and greater than
zero.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#checkNomLongs-int-">checkNomLongs</a></span>(int&nbsp;nomLongs)</code>
<div class="block">Checks that the given nomLongs is within bounds and returns the Log2 of the ceiling power of 2
of the given nomLongs.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#checkProbability-double-java.lang.String-">checkProbability</a></span>(double&nbsp;p,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;argName)</code>
<div class="block">Checks the given parameter to make sure it is positive and between 0.0 inclusive and 1.0
inclusive.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>static short</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#checkSeedHashes-short-short-">checkSeedHashes</a></span>(short&nbsp;seedHashA,
short&nbsp;seedHashB)</code>
<div class="block">Check if the two seed hashes are equal.</div>
</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>static short</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#computeSeedHash-long-">computeSeedHash</a></span>(long&nbsp;seed)</code>
<div class="block">Computes and checks the 16-bit seed hash from the given long seed.</div>
</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code>static double[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#evenlyLogSpaced-double-double-int-">evenlyLogSpaced</a></span>(double&nbsp;value1,
double&nbsp;value2,
int&nbsp;num)</code>
<div class="block">Returns a double array of values between min and max inclusive where the log of the
returned values are evenly spaced.</div>
</td>
</tr>
<tr id="i14" class="altColor">
<td class="colFirst"><code>static double[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#evenlySpaced-double-double-int-">evenlySpaced</a></span>(double&nbsp;value1,
double&nbsp;value2,
int&nbsp;num)</code>
<div class="block">Returns a double array of evenly spaced values between value1 and value2 inclusive.</div>
</td>
</tr>
<tr id="i15" class="rowColor">
<td class="colFirst"><code>static float[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#evenlySpacedFloats-float-float-int-">evenlySpacedFloats</a></span>(float&nbsp;value1,
float&nbsp;value2,
int&nbsp;num)</code>
<div class="block">Returns a float array of evenly spaced values between value1 and value2 inclusive.</div>
</td>
</tr>
<tr id="i16" class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#floorPowerOf2-int-">floorPowerOf2</a></span>(int&nbsp;n)</code>
<div class="block">Computes the floor power of 2 given <i>n</i> is in the range [1, 2^31-1].</div>
</td>
</tr>
<tr id="i17" class="rowColor">
<td class="colFirst"><code>static long</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#floorPowerOf2-long-">floorPowerOf2</a></span>(long&nbsp;n)</code>
<div class="block">Computes the floor power of 2 given <i>n</i> is in the range [1, 2^63-1].</div>
</td>
</tr>
<tr id="i18" class="altColor">
<td class="colFirst"><code>static double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#floorPowerOfBdouble-double-double-">floorPowerOfBdouble</a></span>(double&nbsp;b,
double&nbsp;n)</code>
<div class="block">Computes the floor power of B as a double.</div>
</td>
</tr>
<tr id="i19" class="rowColor">
<td class="colFirst"><code>static byte[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#getResourceBytes-java.lang.String-">getResourceBytes</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;shortFileName)</code>
<div class="block">Returns a byte array of the contents of the file defined by the given resource file's
shortFileName.</div>
</td>
</tr>
<tr id="i20" class="altColor">
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#getResourceFile-java.lang.String-">getResourceFile</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;shortFileName)</code>
<div class="block">Gets the file defined by the given resource file's shortFileName.</div>
</td>
</tr>
<tr id="i21" class="rowColor">
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#getResourcePath-java.lang.String-">getResourcePath</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;shortFileName)</code>
<div class="block">Gets the absolute path of the given resource file's shortName.</div>
</td>
</tr>
<tr id="i22" class="altColor">
<td class="colFirst"><code>static byte[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#intToBytes-int-byte:A-">intToBytes</a></span>(int&nbsp;v,
byte[]&nbsp;arr)</code>
<div class="block">Returns a Little-Endian byte array extracted from the given int.</div>
</td>
</tr>
<tr id="i23" class="rowColor">
<td class="colFirst"><code>static double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#invPow2-int-">invPow2</a></span>(int&nbsp;e)</code>
<div class="block">Computes the inverse integer power of 2: 1/(2^e) = 2^(-e).</div>
</td>
</tr>
<tr id="i24" class="altColor">
<td class="colFirst"><code>static boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#isLessThanUnsigned-long-long-">isLessThanUnsigned</a></span>(long&nbsp;n1,
long&nbsp;n2)</code>
<div class="block">Unsigned compare with longs.</div>
</td>
</tr>
<tr id="i25" class="rowColor">
<td class="colFirst"><code>static boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#isMultipleOf8AndGT0-long-">isMultipleOf8AndGT0</a></span>(long&nbsp;v)</code>
<div class="block">Returns true if v is a multiple of 8 and greater than zero</div>
</td>
</tr>
<tr id="i26" class="altColor">
<td class="colFirst"><code>static boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#isPowerOf2-int-">isPowerOf2</a></span>(int&nbsp;v)</code>
<div class="block">Returns true if argument is exactly a positive power of 2 and greater than zero.</div>
</td>
</tr>
<tr id="i27" class="rowColor">
<td class="colFirst"><code>static double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#log2-double-">log2</a></span>(double&nbsp;value)</code>
<div class="block">The log base 2 of the value</div>
</td>
</tr>
<tr id="i28" class="altColor">
<td class="colFirst"><code>static double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#logB-double-double-">logB</a></span>(double&nbsp;logBase,
double&nbsp;x)</code>
<div class="block">Returns the logarithm_logBase of x.</div>
</td>
</tr>
<tr id="i29" class="rowColor">
<td class="colFirst"><code>static byte[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#longToBytes-long-byte:A-">longToBytes</a></span>(long&nbsp;v,
byte[]&nbsp;arr)</code>
<div class="block">Returns a Little-Endian byte array extracted from the given long.</div>
</td>
</tr>
<tr id="i30" class="altColor">
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#longToHexBytes-long-">longToHexBytes</a></span>(long&nbsp;v)</code>
<div class="block">Returns a string of spaced hex bytes in Big-Endian order.</div>
</td>
</tr>
<tr id="i31" class="rowColor">
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#milliSecToString-long-">milliSecToString</a></span>(long&nbsp;mS)</code>
<div class="block">Returns the given time in milliseconds formatted as Hours:Min:Sec.mSec</div>
</td>
</tr>
<tr id="i32" class="altColor">
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#nanoSecToString-long-">nanoSecToString</a></span>(long&nbsp;nS)</code>
<div class="block">Returns the given time in nanoseconds formatted as Sec.mSec uSec nSec</div>
</td>
</tr>
<tr id="i33" class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#numberOfLeadingOnes-long-">numberOfLeadingOnes</a></span>(long&nbsp;v)</code>
<div class="block">Returns the number of one bits preceding the highest-order ("leftmost") zero-bit in the
two's complement binary representation of the specified long value, or 64 if the value is equal
to minus one.</div>
</td>
</tr>
<tr id="i34" class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#numberOfTrailingOnes-long-">numberOfTrailingOnes</a></span>(long&nbsp;v)</code>
<div class="block">Returns the number of one bits following the lowest-order ("rightmost") zero-bit in the
two's complement binary representation of the specified long value, or 64 if the value is equal
to minus one.</div>
</td>
</tr>
<tr id="i35" class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#pwr2LawNext-int-int-">pwr2LawNext</a></span>(int&nbsp;ppo,
int&nbsp;curPoint)</code>
<div class="block">Computes the next larger integer point in the power series
<i>point = 2<sup>( i / ppo )</sup></i> given the current point in the series.</div>
</td>
</tr>
<tr id="i36" class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#pwr2LawPrev-int-int-">pwr2LawPrev</a></span>(int&nbsp;ppo,
int&nbsp;curPoint)</code>
<div class="block">Computes the previous, smaller integer point in the power series
<i>point = 2<sup>( i / ppo )</sup></i> given the current point in the series.</div>
</td>
</tr>
<tr id="i37" class="rowColor">
<td class="colFirst"><code>static double</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#pwrLawNextDouble-int-double-boolean-double-">pwrLawNextDouble</a></span>(int&nbsp;ppo,
double&nbsp;curPoint,
boolean&nbsp;roundToInt,
double&nbsp;logBase)</code>
<div class="block">Computes the next larger double in the power series
<i>point = logBase<sup>( i / ppo )</sup></i> given the current point in the series.</div>
</td>
</tr>
<tr id="i38" class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#simpleLog2OfLong-long-">simpleLog2OfLong</a></span>(long&nbsp;x)</code>
<div class="block">Gives the log2 of a long that is known to be a power of 2.</div>
</td>
</tr>
<tr id="i39" class="rowColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#startingSubMultiple-int-int-int-">startingSubMultiple</a></span>(int&nbsp;lgTarget,
int&nbsp;lgRF,
int&nbsp;lgMin)</code>
<div class="block">Gets the smallest allowed exponent of 2 that it is a sub-multiple of the target by zero,
one or more resize factors.</div>
</td>
</tr>
<tr id="i40" class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#toLog2-int-java.lang.String-">toLog2</a></span>(int&nbsp;value,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;argName)</code>
<div class="block">Checks the given value if it is a power of 2.</div>
</td>
</tr>
<tr id="i41" class="rowColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#validateValues-float:A-">validateValues</a></span>(float[]&nbsp;values)</code>
<div class="block">Checks the sequential validity of the given array of float values.</div>
</td>
</tr>
<tr id="i42" class="altColor">
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../org/apache/datasketches/Util.html#zeroPad-java.lang.String-int-">zeroPad</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;s,
int&nbsp;fieldLength)</code>
<div class="block">Prepend the given string with zeros.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
<code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.lang">equals</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#hashCode--" title="class or interface in java.lang">hashCode</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="MIN_LG_ARR_LONGS">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>MIN_LG_ARR_LONGS</h4>
<pre>public static final&nbsp;int MIN_LG_ARR_LONGS</pre>
<div class="block">The smallest Log2 cache size allowed: 5.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#org.apache.datasketches.Util.MIN_LG_ARR_LONGS">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="MIN_LG_NOM_LONGS">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>MIN_LG_NOM_LONGS</h4>
<pre>public static final&nbsp;int MIN_LG_NOM_LONGS</pre>
<div class="block">The smallest Log2 nom entries allowed: 4.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#org.apache.datasketches.Util.MIN_LG_NOM_LONGS">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="MAX_LG_NOM_LONGS">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>MAX_LG_NOM_LONGS</h4>
<pre>public static final&nbsp;int MAX_LG_NOM_LONGS</pre>
<div class="block">The largest Log2 nom entries allowed: 26.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#org.apache.datasketches.Util.MAX_LG_NOM_LONGS">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="REBUILD_THRESHOLD">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>REBUILD_THRESHOLD</h4>
<pre>public static final&nbsp;double REBUILD_THRESHOLD</pre>
<div class="block">The hash table rebuild threshold = 15.0/16.0.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#org.apache.datasketches.Util.REBUILD_THRESHOLD">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="RESIZE_THRESHOLD">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>RESIZE_THRESHOLD</h4>
<pre>public static final&nbsp;double RESIZE_THRESHOLD</pre>
<div class="block">The resize threshold = 0.5; tuned for speed.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#org.apache.datasketches.Util.RESIZE_THRESHOLD">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="DEFAULT_NOMINAL_ENTRIES">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>DEFAULT_NOMINAL_ENTRIES</h4>
<pre>public static final&nbsp;int DEFAULT_NOMINAL_ENTRIES</pre>
<div class="block">The default nominal entries is provided as a convenience for those cases where the
nominal sketch size in number of entries is not provided.
A sketch of 4096 entries has a Relative Standard Error (RSE) of +/- 1.56% at a confidence of
68%; or equivalently, a Relative Error of +/- 3.1% at a confidence of 95.4%.
<a href="../../../resources/dictionary.html#defaultNomEntries">See Default Nominal Entries</a></div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#org.apache.datasketches.Util.DEFAULT_NOMINAL_ENTRIES">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="DEFAULT_UPDATE_SEED">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>DEFAULT_UPDATE_SEED</h4>
<pre>public static final&nbsp;long DEFAULT_UPDATE_SEED</pre>
<div class="block">The seed 9001 used in the sketch update methods is a prime number that
was chosen very early on in experimental testing. Choosing a seed is somewhat arbitrary, and
the author cannot prove that this particular seed is somehow superior to other seeds. There
was some early Internet discussion that a seed of 0 did not produce as clean avalanche diagrams
as non-zero seeds, but this may have been more related to the MurmurHash2 release, which did
have some issues. As far as the author can determine, MurmurHash3 does not have these problems.
<p>In order to perform set operations on two sketches it is critical that the same hash
function and seed are identical for both sketches, otherwise the assumed 1:1 relationship
between the original source key value and the hashed bit string would be violated. Once
you have developed a history of stored sketches you are stuck with it.
<p><b>WARNING:</b> This seed is used internally by library sketches in different
packages and thus must be declared public. However, this seed value must not be used by library
users with the MurmurHash3 function. It should be viewed as existing for exclusive, private
use by the library.
<p><a href="../../../resources/dictionary.html#defaultUpdateSeed">See Default Update Seed</a></div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#org.apache.datasketches.Util.DEFAULT_UPDATE_SEED">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="LS">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>LS</h4>
<pre>public static final&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> LS</pre>
<div class="block">The java line separator character as a String.</div>
</li>
</ul>
<a name="TAB">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>TAB</h4>
<pre>public static final&nbsp;char TAB</pre>
<div class="block">The tab character</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#org.apache.datasketches.Util.TAB">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="LOG2">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>LOG2</h4>
<pre>public static final&nbsp;double LOG2</pre>
<div class="block">The natural logarithm of 2.0.</div>
</li>
</ul>
<a name="iGoldenU64">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>iGoldenU64</h4>
<pre>public static final&nbsp;long iGoldenU64</pre>
<div class="block">The inverse golden ratio as an unsigned long.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#org.apache.datasketches.Util.iGoldenU64">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="iGolden">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>iGolden</h4>
<pre>public static final&nbsp;double iGolden</pre>
<div class="block">The inverse golden ratio as a fraction.
This has more precision than using the formula: (Math.sqrt(5.0) - 1.0) / 2.0.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#org.apache.datasketches.Util.iGolden">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="LONG_MAX_VALUE_AS_DOUBLE">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>LONG_MAX_VALUE_AS_DOUBLE</h4>
<pre>public static final&nbsp;double LONG_MAX_VALUE_AS_DOUBLE</pre>
<div class="block">Long.MAX_VALUE as a double.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#org.apache.datasketches.Util.LONG_MAX_VALUE_AS_DOUBLE">Constant Field Values</a></dd>
</dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="bytesToInt-byte:A-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>bytesToInt</h4>
<pre>public static&nbsp;int&nbsp;bytesToInt(byte[]&nbsp;arr)</pre>
<div class="block">Returns an int extracted from a Little-Endian byte array.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>arr</code> - the given byte array</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>an int extracted from a Little-Endian byte array.</dd>
</dl>
</li>
</ul>
<a name="bytesToLong-byte:A-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>bytesToLong</h4>
<pre>public static&nbsp;long&nbsp;bytesToLong(byte[]&nbsp;arr)</pre>
<div class="block">Returns a long extracted from a Little-Endian byte array.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>arr</code> - the given byte array</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a long extracted from a Little-Endian byte array.</dd>
</dl>
</li>
</ul>
<a name="intToBytes-int-byte:A-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>intToBytes</h4>
<pre>public static&nbsp;byte[]&nbsp;intToBytes(int&nbsp;v,
byte[]&nbsp;arr)</pre>
<div class="block">Returns a Little-Endian byte array extracted from the given int.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>v</code> - the given int</dd>
<dd><code>arr</code> - a given array of 4 bytes that will be returned with the data</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a Little-Endian byte array extracted from the given int.</dd>
</dl>
</li>
</ul>
<a name="longToBytes-long-byte:A-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>longToBytes</h4>
<pre>public static&nbsp;byte[]&nbsp;longToBytes(long&nbsp;v,
byte[]&nbsp;arr)</pre>
<div class="block">Returns a Little-Endian byte array extracted from the given long.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>v</code> - the given long</dd>
<dd><code>arr</code> - a given array of 8 bytes that will be returned with the data</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a Little-Endian byte array extracted from the given long.</dd>
</dl>
</li>
</ul>
<a name="longToHexBytes-long-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>longToHexBytes</h4>
<pre>public static&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;longToHexBytes(long&nbsp;v)</pre>
<div class="block">Returns a string of spaced hex bytes in Big-Endian order.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>v</code> - the given long</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>string of spaced hex bytes in Big-Endian order.</dd>
</dl>
</li>
</ul>
<a name="bytesToString-byte:A-boolean-boolean-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>bytesToString</h4>
<pre>public static&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;bytesToString(byte[]&nbsp;arr,
boolean&nbsp;signed,
boolean&nbsp;littleEndian,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;sep)</pre>
<div class="block">Returns a string view of a byte array</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>arr</code> - the given byte array</dd>
<dd><code>signed</code> - set true if you want the byte values signed.</dd>
<dd><code>littleEndian</code> - set true if you want Little-Endian order</dd>
<dd><code>sep</code> - the separator string between bytes</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a string view of a byte array</dd>
</dl>
</li>
</ul>
<a name="nanoSecToString-long-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>nanoSecToString</h4>
<pre>public static&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;nanoSecToString(long&nbsp;nS)</pre>
<div class="block">Returns the given time in nanoseconds formatted as Sec.mSec uSec nSec</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>nS</code> - the given nanoseconds</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the given time in nanoseconds formatted as Sec.mSec uSec nSec</dd>
</dl>
</li>
</ul>
<a name="milliSecToString-long-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>milliSecToString</h4>
<pre>public static&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;milliSecToString(long&nbsp;mS)</pre>
<div class="block">Returns the given time in milliseconds formatted as Hours:Min:Sec.mSec</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>mS</code> - the given nanoseconds</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the given time in milliseconds formatted as Hours:Min:Sec.mSec</dd>
</dl>
</li>
</ul>
<a name="zeroPad-java.lang.String-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>zeroPad</h4>
<pre>public static&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;zeroPad(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;s,
int&nbsp;fieldLength)</pre>
<div class="block">Prepend the given string with zeros. If the given string is equal or greater than the given
field length, it will be returned without modification.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>s</code> - the given string</dd>
<dd><code>fieldLength</code> - desired total field length including the given string</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the given string prepended with zeros.</dd>
</dl>
</li>
</ul>
<a name="characterPad-java.lang.String-int-char-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>characterPad</h4>
<pre>public static&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;characterPad(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;s,
int&nbsp;fieldLength,
char&nbsp;padChar,
boolean&nbsp;postpend)</pre>
<div class="block">Prepend or postpend the given string with the given character to fill the given field length.
If the given string is equal or greater than the given field length, it will be returned
without modification.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>s</code> - the given string</dd>
<dd><code>fieldLength</code> - the desired field length</dd>
<dd><code>padChar</code> - the desired pad character</dd>
<dd><code>postpend</code> - if true append the pacCharacters to the end of the string.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>prepended or postpended given string with the given character to fill the given field
length.</dd>
</dl>
</li>
</ul>
<a name="checkSeedHashes-short-short-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>checkSeedHashes</h4>
<pre>public static&nbsp;short&nbsp;checkSeedHashes(short&nbsp;seedHashA,
short&nbsp;seedHashB)</pre>
<div class="block">Check if the two seed hashes are equal. If not, throw an SketchesArgumentException.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>seedHashA</code> - the seedHash A</dd>
<dd><code>seedHashB</code> - the seedHash B</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>seedHashA if they are equal</dd>
</dl>
</li>
</ul>
<a name="computeSeedHash-long-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>computeSeedHash</h4>
<pre>public static&nbsp;short&nbsp;computeSeedHash(long&nbsp;seed)</pre>
<div class="block">Computes and checks the 16-bit seed hash from the given long seed.
The seed hash may not be zero in order to maintain compatibility with older serialized
versions that did not have this concept.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>seed</code> - <a href="../../../resources/dictionary.html#seed">See Update Hash Seed</a></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the seed hash.</dd>
</dl>
</li>
</ul>
<a name="checkIfMultipleOf8AndGT0-long-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>checkIfMultipleOf8AndGT0</h4>
<pre>public static&nbsp;void&nbsp;checkIfMultipleOf8AndGT0(long&nbsp;v,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;argName)</pre>
<div class="block">Checks if parameter v is a multiple of 8 and greater than zero.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>v</code> - The parameter to check</dd>
<dd><code>argName</code> - This name will be part of the error message if the check fails.</dd>
</dl>
</li>
</ul>
<a name="isMultipleOf8AndGT0-long-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isMultipleOf8AndGT0</h4>
<pre>public static&nbsp;boolean&nbsp;isMultipleOf8AndGT0(long&nbsp;v)</pre>
<div class="block">Returns true if v is a multiple of 8 and greater than zero</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>v</code> - The parameter to check</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true if v is a multiple of 8 and greater than zero</dd>
</dl>
</li>
</ul>
<a name="numberOfTrailingOnes-long-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>numberOfTrailingOnes</h4>
<pre>public static&nbsp;int&nbsp;numberOfTrailingOnes(long&nbsp;v)</pre>
<div class="block">Returns the number of one bits following the lowest-order ("rightmost") zero-bit in the
two's complement binary representation of the specified long value, or 64 if the value is equal
to minus one.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>v</code> - the value whose number of trailing ones is to be computed.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the number of one bits following the lowest-order ("rightmost") zero-bit in the
two's complement binary representation of the specified long value, or 64 if the value is equal
to minus one.</dd>
</dl>
</li>
</ul>
<a name="numberOfLeadingOnes-long-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>numberOfLeadingOnes</h4>
<pre>public static&nbsp;int&nbsp;numberOfLeadingOnes(long&nbsp;v)</pre>
<div class="block">Returns the number of one bits preceding the highest-order ("leftmost") zero-bit in the
two's complement binary representation of the specified long value, or 64 if the value is equal
to minus one.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>v</code> - the value whose number of leading ones is to be computed.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the number of one bits preceding the lowest-order ("rightmost") zero-bit in the
two's complement binary representation of the specified long value, or 64 if the value is equal
to minus one.</dd>
</dl>
</li>
</ul>
<a name="isPowerOf2-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isPowerOf2</h4>
<pre>public static&nbsp;boolean&nbsp;isPowerOf2(int&nbsp;v)</pre>
<div class="block">Returns true if argument is exactly a positive power of 2 and greater than zero.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>v</code> - The input argument.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true if argument is exactly a positive power of 2 and greater than zero.</dd>
</dl>
</li>
</ul>
<a name="checkIfPowerOf2-int-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>checkIfPowerOf2</h4>
<pre>public static&nbsp;void&nbsp;checkIfPowerOf2(int&nbsp;v,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;argName)</pre>
<div class="block">Checks the given parameter to make sure it is positive, an integer-power of 2 and greater than
zero.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>v</code> - The input argument.</dd>
<dd><code>argName</code> - Used in the thrown exception.</dd>
</dl>
</li>
</ul>
<a name="toLog2-int-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toLog2</h4>
<pre>public static&nbsp;int&nbsp;toLog2(int&nbsp;value,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;argName)</pre>
<div class="block">Checks the given value if it is a power of 2. If not, it throws an exception.
Otherwise, returns the log-base2 of the given value.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>value</code> - must be a power of 2 and greater than zero.</dd>
<dd><code>argName</code> - the argument name used in the exception if thrown.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the log-base2 of the given value</dd>
</dl>
</li>
</ul>
<a name="simpleLog2OfLong-long-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>simpleLog2OfLong</h4>
<pre>public static&nbsp;int&nbsp;simpleLog2OfLong(long&nbsp;x)</pre>
<div class="block">Gives the log2 of a long that is known to be a power of 2.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>x</code> - number that is greater than zero</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the log2 of a long that is known to be a power of 2.</dd>
</dl>
</li>
</ul>
<a name="ceilingPowerOf2-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>ceilingPowerOf2</h4>
<pre>public static&nbsp;int&nbsp;ceilingPowerOf2(int&nbsp;n)</pre>
<div class="block">Computes the ceiling power of 2 within the range [1, 2^30]. This is the smallest positive power
of 2 that is equal to or greater than the given n and a mathematical integer.
<p>For:
<ul>
<li>n &le; 1: returns 1</li>
<li>2^30 &le; n &le; 2^31 -1 : returns 2^30</li>
<li>n == a power of 2 : returns n</li>
<li>otherwise returns the smallest power of 2 &ge; n and equal to a mathematical
integer</li>
</ul></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>n</code> - The input argument.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the ceiling power of 2.</dd>
</dl>
</li>
</ul>
<a name="evenlySpaced-double-double-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>evenlySpaced</h4>
<pre>public static&nbsp;double[]&nbsp;evenlySpaced(double&nbsp;value1,
double&nbsp;value2,
int&nbsp;num)</pre>
<div class="block">Returns a double array of evenly spaced values between value1 and value2 inclusive.
If value2 &gt; value1, the resulting sequence will be increasing.
If value2 &lt; value1, the resulting sequence will be decreasing.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>value1</code> - will be in index 0 of the returned array</dd>
<dd><code>value2</code> - will be in the highest index of the returned array</dd>
<dd><code>num</code> - the total number of values including value1 and value2. Must be 2 or greater.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a double array of evenly spaced values between value1 and value2 inclusive.</dd>
</dl>
</li>
</ul>
<a name="evenlySpacedFloats-float-float-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>evenlySpacedFloats</h4>
<pre>public static&nbsp;float[]&nbsp;evenlySpacedFloats(float&nbsp;value1,
float&nbsp;value2,
int&nbsp;num)</pre>
<div class="block">Returns a float array of evenly spaced values between value1 and value2 inclusive.
If value2 &gt; value1, the resulting sequence will be increasing.
If value2 &lt; value1, the resulting sequence will be decreasing.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>value1</code> - will be in index 0 of the returned array</dd>
<dd><code>value2</code> - will be in the highest index of the returned array</dd>
<dd><code>num</code> - the total number of values including value1 and value2. Must be 2 or greater.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a float array of evenly spaced values between value1 and value2 inclusive.</dd>
</dl>
</li>
</ul>
<a name="evenlyLogSpaced-double-double-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>evenlyLogSpaced</h4>
<pre>public static&nbsp;double[]&nbsp;evenlyLogSpaced(double&nbsp;value1,
double&nbsp;value2,
int&nbsp;num)</pre>
<div class="block">Returns a double array of values between min and max inclusive where the log of the
returned values are evenly spaced.
If value2 &gt; value1, the resulting sequence will be increasing.
If value2 &lt; value1, the resulting sequence will be decreasing.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>value1</code> - will be in index 0 of the returned array, and must be greater than zero.</dd>
<dd><code>value2</code> - will be in the highest index of the returned array, and must be greater than zero.</dd>
<dd><code>num</code> - the total number of values including value1 and value2. Must be 2 or greater</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a double array of exponentially spaced values between value1 and value2 inclusive.</dd>
</dl>
</li>
</ul>
<a name="floorPowerOf2-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>floorPowerOf2</h4>
<pre>public static&nbsp;int&nbsp;floorPowerOf2(int&nbsp;n)</pre>
<div class="block">Computes the floor power of 2 given <i>n</i> is in the range [1, 2^31-1].
This is the largest positive power of 2 that equal to or less than the given n and equal
to a mathematical integer.
<p>For:
<ul>
<li>n &le; 1: returns 1</li>
<li>2^30 &le; n &le; 2^31 -1 : returns 2^30</li>
<li>n == a power of 2 : returns n</li>
<li>otherwise returns the largest power of 2 less than n and equal to a mathematical
integer.</li>
</ul></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>n</code> - The given int argument.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the floor power of 2 as an int.</dd>
</dl>
</li>
</ul>
<a name="floorPowerOf2-long-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>floorPowerOf2</h4>
<pre>public static&nbsp;long&nbsp;floorPowerOf2(long&nbsp;n)</pre>
<div class="block">Computes the floor power of 2 given <i>n</i> is in the range [1, 2^63-1].
This is the largest positive power of 2 that is equal to or less than the given <i>n</i> and
equal to a mathematical integer.
<p>For:
<ul>
<li>n &le; 1: returns 1</li>
<li>2^62 &le; n &le; 2^63 -1 : returns 2^62</li>
<li>n == a power of 2 : returns n</li>
<li>otherwise returns the largest power of 2 less than n and equal to a mathematical
integer.</li>
</ul></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>n</code> - The given long argument.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the floor power of 2 as a long</dd>
</dl>
</li>
</ul>
<a name="invPow2-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>invPow2</h4>
<pre>public static&nbsp;double&nbsp;invPow2(int&nbsp;e)</pre>
<div class="block">Computes the inverse integer power of 2: 1/(2^e) = 2^(-e).</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>e</code> - a positive value between 0 and 1023 inclusive</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the inverse integer power of 2: 1/(2^e) = 2^(-e)</dd>
</dl>
</li>
</ul>
<a name="pwr2LawNext-int-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>pwr2LawNext</h4>
<pre>public static&nbsp;int&nbsp;pwr2LawNext(int&nbsp;ppo,
int&nbsp;curPoint)</pre>
<div class="block">Computes the next larger integer point in the power series
<i>point = 2<sup>( i / ppo )</sup></i> given the current point in the series.
For illustration, this can be used in a loop as follows:
<pre><code>
int maxP = 1024;
int minP = 1;
int ppo = 2;
for (int p = minP; p &lt;= maxP; p = pwr2LawNext(ppo, p)) {
System.out.print(p + " ");
}
//generates the following series:
//1 2 3 4 6 8 11 16 23 32 45 64 91 128 181 256 362 512 724 1024
</code></pre></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>ppo</code> - Points-Per-Octave, or the number of points per integer powers of 2 in the series.</dd>
<dd><code>curPoint</code> - the current point of the series. Must be &ge; 1.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the next point in the power series.</dd>
</dl>
</li>
</ul>
<a name="pwr2LawPrev-int-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>pwr2LawPrev</h4>
<pre>public static&nbsp;int&nbsp;pwr2LawPrev(int&nbsp;ppo,
int&nbsp;curPoint)</pre>
<div class="block">Computes the previous, smaller integer point in the power series
<i>point = 2<sup>( i / ppo )</sup></i> given the current point in the series.
For illustration, this can be used in a loop as follows:
<pre><code>
int maxP = 1024;
int minP = 1;
int ppo = 2;
for (int p = maxP; p &gt;= minP; p = pwr2LawPrev(ppo, p)) {
System.out.print(p + " ");
}
//generates the following series:
//1024 724 512 362 256 181 128 91 64 45 32 23 16 11 8 6 4 3 2 1
</code></pre></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>ppo</code> - Points-Per-Octave, or the number of points per integer powers of 2 in the series.</dd>
<dd><code>curPoint</code> - the current point of the series. Must be &ge; 1.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the previous, smaller point in the power series.
A returned value of zero terminates the series.</dd>
</dl>
</li>
</ul>
<a name="log2-double-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>log2</h4>
<pre>public static&nbsp;double&nbsp;log2(double&nbsp;value)</pre>
<div class="block">The log base 2 of the value</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>value</code> - the given value</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The log base 2 of the value</dd>
</dl>
</li>
</ul>
<a name="startingSubMultiple-int-int-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>startingSubMultiple</h4>
<pre>public static&nbsp;int&nbsp;startingSubMultiple(int&nbsp;lgTarget,
int&nbsp;lgRF,
int&nbsp;lgMin)</pre>
<div class="block">Gets the smallest allowed exponent of 2 that it is a sub-multiple of the target by zero,
one or more resize factors.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>lgTarget</code> - Log2 of the target size</dd>
<dd><code>lgRF</code> - Log_base2 of Resize Factor.
<a href="../../../resources/dictionary.html#resizeFactor">See Resize Factor</a></dd>
<dd><code>lgMin</code> - Log2 of the minimum allowed starting size</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The Log2 of the starting size</dd>
</dl>
</li>
</ul>
<a name="ceilingPowerOfBdouble-double-double-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>ceilingPowerOfBdouble</h4>
<pre>public static&nbsp;double&nbsp;ceilingPowerOfBdouble(double&nbsp;b,
double&nbsp;n)</pre>
<div class="block">Computes the ceiling power of B as a double. This is the smallest positive power
of B that equal to or greater than the given n and equal to a mathematical integer.
The result of this function is consistent with <a href="../../../org/apache/datasketches/Util.html#ceilingPowerOf2-int-"><code>ceilingPowerOf2(int)</code></a> for values
less than one. I.e., if <i>n &lt; 1,</i> the result is 1.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>b</code> - The base in the expression &#8968;b<sup>n</sup>&#8969;.</dd>
<dd><code>n</code> - The input argument.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the ceiling power of B as a double and equal to a mathematical integer.</dd>
</dl>
</li>
</ul>
<a name="floorPowerOfBdouble-double-double-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>floorPowerOfBdouble</h4>
<pre>public static&nbsp;double&nbsp;floorPowerOfBdouble(double&nbsp;b,
double&nbsp;n)</pre>
<div class="block">Computes the floor power of B as a double. This is the largest positive power
of B that equal to or less than the given n and equal to a mathematical integer.
The result of this function is consistent with <a href="../../../org/apache/datasketches/Util.html#floorPowerOf2-int-"><code>floorPowerOf2(int)</code></a> for values
less than one. I.e., if <i>n &lt; 1,</i> the result is 1.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>b</code> - The base in the expression &#8970;b<sup>n</sup>&#8971;.</dd>
<dd><code>n</code> - The input argument.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the floor power of 2 and equal to a mathematical integer.</dd>
</dl>
</li>
</ul>
<a name="logB-double-double-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>logB</h4>
<pre>public static&nbsp;double&nbsp;logB(double&nbsp;logBase,
double&nbsp;x)</pre>
<div class="block">Returns the logarithm_logBase of x. Example: logB(2.0, x) = log(x) / log(2.0).</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>logBase</code> - the base of the logarithm used</dd>
<dd><code>x</code> - the given value</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the logarithm_logBase of x: Example: logB(2.0, x) = log(x) / log(2.0).</dd>
</dl>
</li>
</ul>
<a name="pwrLawNextDouble-int-double-boolean-double-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>pwrLawNextDouble</h4>
<pre>public static&nbsp;double&nbsp;pwrLawNextDouble(int&nbsp;ppo,
double&nbsp;curPoint,
boolean&nbsp;roundToInt,
double&nbsp;logBase)</pre>
<div class="block">Computes the next larger double in the power series
<i>point = logBase<sup>( i / ppo )</sup></i> given the current point in the series.
For illustration, this can be used in a loop as follows:
<pre><code>
double maxP = 1024.0;
double minP = 1.0;
int ppo = 2;
double logBase = 2.0;
for (double p = minP; p &lt;= maxP; p = pwr2LawNextDouble(ppo, p, true, logBase)) {
System.out.print(Math.round(p) + " ");
}
//generates the following series:
//1 2 3 4 6 8 11 16 23 32 45 64 91 128 181 256 362 512 724 1024
</code></pre></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>ppo</code> - Points-Per-Octave, or the number of points per integer powers of 2 in the series.</dd>
<dd><code>curPoint</code> - the current point of the series. Must be &ge; 1.0.</dd>
<dd><code>roundToInt</code> - if true the output will be rounded to the nearest integer.</dd>
<dd><code>logBase</code> - the desired base of the logarithms</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the next point in the power series.</dd>
</dl>
</li>
</ul>
<a name="checkBounds-long-long-long-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>checkBounds</h4>
<pre>public static&nbsp;void&nbsp;checkBounds(long&nbsp;reqOff,
long&nbsp;reqLen,
long&nbsp;allocSize)</pre>
<div class="block">Check the requested offset and length against the allocated size.
The invariants equation is: <code>0 &lt;= reqOff &lt;= reqLen &lt;= reqOff + reqLen &lt;= allocSize</code>.
If this equation is violated an <a href="../../../org/apache/datasketches/SketchesArgumentException.html" title="class in org.apache.datasketches"><code>SketchesArgumentException</code></a> will be thrown.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>reqOff</code> - the requested offset</dd>
<dd><code>reqLen</code> - the requested length</dd>
<dd><code>allocSize</code> - the allocated size.</dd>
</dl>
</li>
</ul>
<a name="checkNomLongs-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>checkNomLongs</h4>
<pre>public static&nbsp;int&nbsp;checkNomLongs(int&nbsp;nomLongs)</pre>
<div class="block">Checks that the given nomLongs is within bounds and returns the Log2 of the ceiling power of 2
of the given nomLongs.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>nomLongs</code> - the given number of nominal longs. This can be any value from 16 to
67108864, inclusive.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The Log2 of the ceiling power of 2 of the given nomLongs.</dd>
</dl>
</li>
</ul>
<a name="checkProbability-double-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>checkProbability</h4>
<pre>public static&nbsp;void&nbsp;checkProbability(double&nbsp;p,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;argName)</pre>
<div class="block">Checks the given parameter to make sure it is positive and between 0.0 inclusive and 1.0
inclusive.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>p</code> - <a href="../../../resources/dictionary.html#p">See Sampling Probability, <i>p</i></a></dd>
<dd><code>argName</code> - Used in the thrown exception.</dd>
</dl>
</li>
</ul>
<a name="isLessThanUnsigned-long-long-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isLessThanUnsigned</h4>
<pre>public static&nbsp;boolean&nbsp;isLessThanUnsigned(long&nbsp;n1,
long&nbsp;n2)</pre>
<div class="block">Unsigned compare with longs.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>n1</code> - A long to be treated as if unsigned.</dd>
<dd><code>n2</code> - A long to be treated as if unsigned.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true if n1 &gt; n2.</dd>
</dl>
</li>
</ul>
<a name="getResourcePath-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getResourcePath</h4>
<pre>public static&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;getResourcePath(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;shortFileName)</pre>
<div class="block">Gets the absolute path of the given resource file's shortName.
<p>Note that the ClassLoader.getResource(shortName) returns a URL,
which can have special characters, e.g., "%20" for spaces. This method
obtains the URL, converts it to a URI, then does a uri.getPath(), which
decodes any special characters in the URI path. This is required to make
obtaining resources operating-system independent.</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>shortFileName</code> - the last name in the pathname's name sequence.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the absolute path of the given resource file's shortName.</dd>
</dl>
</li>
</ul>
<a name="getResourceFile-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getResourceFile</h4>
<pre>public static&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a>&nbsp;getResourceFile(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;shortFileName)</pre>
<div class="block">Gets the file defined by the given resource file's shortFileName.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>shortFileName</code> - the last name in the pathname's name sequence.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the file defined by the given resource file's shortFileName.</dd>
</dl>
</li>
</ul>
<a name="getResourceBytes-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getResourceBytes</h4>
<pre>public static&nbsp;byte[]&nbsp;getResourceBytes(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;shortFileName)</pre>
<div class="block">Returns a byte array of the contents of the file defined by the given resource file's
shortFileName.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>shortFileName</code> - the last name in the pathname's name sequence.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a byte array of the contents of the file defined by the given resource file's
shortFileName.</dd>
</dl>
</li>
</ul>
<a name="validateValues-float:A-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>validateValues</h4>
<pre>public static&nbsp;void&nbsp;validateValues(float[]&nbsp;values)</pre>
<div class="block">Checks the sequential validity of the given array of float values.
They must be unique, monotonically increasing and not NaN.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>values</code> - the given array of values</dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/Util.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../org/apache/datasketches/SketchesStateException.html" title="class in org.apache.datasketches"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li>Next&nbsp;Class</li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?org/apache/datasketches/Util.html" target="_top">Frames</a></li>
<li><a href="Util.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2015&#x2013;2020 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</body>
</html>