| <!DOCTYPE HTML> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc --> |
| <title>Util (datasketches-java 4.0.0 API)</title> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../../jquery/jquery-ui.min.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../../jquery-ui.overrides.css" title="Style"> |
| <script type="text/javascript" src="../../../../script.js"></script> |
| <script type="text/javascript" src="../../../../jquery/jszip/dist/jszip.min.js"></script> |
| <script type="text/javascript" src="../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script> |
| <!--[if IE]> |
| <script type="text/javascript" src="../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script> |
| <![endif]--> |
| <script type="text/javascript" src="../../../../jquery/jquery-3.6.0.min.js"></script> |
| <script type="text/javascript" src="../../../../jquery/jquery-ui.min.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="Util (datasketches-java 4.0.0 API)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var data = {"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}; |
| 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"; |
| var pathtoroot = "../../../../"; |
| var useModuleDirectories = true; |
| loadScripts(document, 'script');</script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <header role="banner"> |
| <nav role="navigation"> |
| <div class="fixedNav"> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a id="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <a id="navbar.top.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../index.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" id="allclasses_navbar_top"> |
| <li><a href="../../../../allclasses.html">All Classes</a></li> |
| </ul> |
| <ul class="navListSearch"> |
| <li><label for="search">SEARCH:</label> |
| <input type="text" id="search" value="search" disabled="disabled"> |
| <input type="reset" id="reset" value="reset" disabled="disabled"> |
| </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> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li><a href="#field.summary">Field</a> | </li> |
| <li>Constr | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li><a href="#field.detail">Field</a> | </li> |
| <li>Constr | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a id="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| </div> |
| <div class="navPadding"> </div> |
| <script type="text/javascript"><!-- |
| $('.navPadding').css('padding-top', $('.fixedNav').css("height")); |
| //--> |
| </script> |
| </nav> |
| </header> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <main role="main"> |
| <div class="header"> |
| <div class="subTitle"><span class="packageLabelInType">Package</span> <a href="package-summary.html">org.apache.datasketches.common</a></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" class="externalLink">java.lang.Object</a></li> |
| <li> |
| <ul class="inheritance"> |
| <li>org.apache.datasketches.common.Util</li> |
| </ul> |
| </li> |
| </ul> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <hr> |
| <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" class="externalLink">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 =========== --> |
| <section> |
| <ul class="blockList"> |
| <li class="blockList"><a id="field.summary"> |
| <!-- --> |
| </a> |
| <h3>Field Summary</h3> |
| <table class="memberSummary"> |
| <caption><span>Fields</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colSecond" scope="col">Field</th> |
| <th class="colLast" scope="col">Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static double</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#INVERSE_GOLDEN">INVERSE_GOLDEN</a></span></code></th> |
| <td class="colLast"> |
| <div class="block">The inverse golden ratio as a fraction.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static long</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#INVERSE_GOLDEN_U64">INVERSE_GOLDEN_U64</a></span></code></th> |
| <td class="colLast"> |
| <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> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#LOG2">LOG2</a></span></code></th> |
| <td class="colLast"> |
| <div class="block">The natural logarithm of 2.0.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static double</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#LONG_MAX_VALUE_AS_DOUBLE">LONG_MAX_VALUE_AS_DOUBLE</a></span></code></th> |
| <td class="colLast"> |
| <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" class="externalLink">String</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#LS">LS</a></span></code></th> |
| <td class="colLast"> |
| <div class="block">The java line separator character as a String.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>static char</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#TAB">TAB</a></span></code></th> |
| <td class="colLast"> |
| <div class="block">The tab character</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| </section> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <section> |
| <ul class="blockList"> |
| <li class="blockList"><a id="method.summary"> |
| <!-- --> |
| </a> |
| <h3>Method Summary</h3> |
| <table class="memberSummary"> |
| <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colSecond" scope="col">Method</th> |
| <th class="colLast" scope="col">Description</th> |
| </tr> |
| <tr id="i0" class="altColor"> |
| <td class="colFirst"><code>static int</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#bytesToInt(byte%5B%5D)">bytesToInt</a></span>​(byte[] arr)</code></th> |
| <td class="colLast"> |
| <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> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#bytesToLong(byte%5B%5D)">bytesToLong</a></span>​(byte[] arr)</code></th> |
| <td class="colLast"> |
| <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" class="externalLink">String</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#bytesToString(byte%5B%5D,boolean,boolean,java.lang.String)">bytesToString</a></span>​(byte[] arr, |
| boolean signed, |
| boolean 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" class="externalLink">String</a> sep)</code></th> |
| <td class="colLast"> |
| <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> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#ceilingIntPowerOf2(int)">ceilingIntPowerOf2</a></span>​(int n)</code></th> |
| <td class="colLast"> |
| <div class="block">Computes the int ceiling power of 2 within the range [1, 2^30].</div> |
| </td> |
| </tr> |
| <tr id="i4" class="altColor"> |
| <td class="colFirst"><code>static long</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#ceilingLongPowerOf2(long)">ceilingLongPowerOf2</a></span>​(long n)</code></th> |
| <td class="colLast"> |
| <div class="block">Computes the long ceiling power of 2 within the range [1, 2^30].</div> |
| </td> |
| </tr> |
| <tr id="i5" class="rowColor"> |
| <td class="colFirst"><code>static double</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#ceilingPowerBaseOfDouble(double,double)">ceilingPowerBaseOfDouble</a></span>​(double base, |
| double n)</code></th> |
| <td class="colLast"> |
| <div class="block">Computes the ceiling power of given <i>base</i> and <i>n</i> as doubles.</div> |
| </td> |
| </tr> |
| <tr id="i6" 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" class="externalLink">String</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#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" class="externalLink">String</a> s, |
| int fieldLength, |
| char padChar, |
| boolean postpend)</code></th> |
| <td class="colLast"> |
| <div class="block">Prepend or postpend the given string with the given character to fill the given field length.</div> |
| </td> |
| </tr> |
| <tr id="i7" class="rowColor"> |
| <td class="colFirst"><code>static void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#checkBounds(long,long,long)">checkBounds</a></span>​(long reqOff, |
| long reqLen, |
| long allocSize)</code></th> |
| <td class="colLast"> |
| <div class="block">Check the requested offset and length against the allocated size.</div> |
| </td> |
| </tr> |
| <tr id="i8" class="altColor"> |
| <td class="colFirst"><code>static void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#checkIfIntPowerOf2(int,java.lang.String)">checkIfIntPowerOf2</a></span>​(int powerOf2, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> argName)</code></th> |
| <td class="colLast"> |
| <div class="block">Checks the given int argument to make sure it is a positive power of 2 and greater than zero.</div> |
| </td> |
| </tr> |
| <tr id="i9" class="rowColor"> |
| <td class="colFirst"><code>static void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#checkIfLongPowerOf2(long,java.lang.String)">checkIfLongPowerOf2</a></span>​(long powerOf2, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> argName)</code></th> |
| <td class="colLast"> |
| <div class="block">Checks the given long argument to make sure it is a positive power of 2 and greater than zero.</div> |
| </td> |
| </tr> |
| <tr id="i10" class="altColor"> |
| <td class="colFirst"><code>static void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#checkIfMultipleOf8AndGT0(long,java.lang.String)">checkIfMultipleOf8AndGT0</a></span>​(long 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" class="externalLink">String</a> argName)</code></th> |
| <td class="colLast"> |
| <div class="block">Checks if parameter v is a multiple of 8 and greater than zero.</div> |
| </td> |
| </tr> |
| <tr id="i11" class="rowColor"> |
| <td class="colFirst"><code>static void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#checkProbability(double,java.lang.String)">checkProbability</a></span>​(double 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" class="externalLink">String</a> argName)</code></th> |
| <td class="colLast"> |
| <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="i12" class="altColor"> |
| <td class="colFirst"><code>static int</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#exactLog2OfInt(int)">exactLog2OfInt</a></span>​(int powerOf2)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the log2 of the given int value if it is an exact power of 2 and greater than zero.</div> |
| </td> |
| </tr> |
| <tr id="i13" class="rowColor"> |
| <td class="colFirst"><code>static int</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#exactLog2OfInt(int,java.lang.String)">exactLog2OfInt</a></span>​(int powerOf2, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> argName)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the log2 of the given int value if it is an exact power of 2 and greater than zero.</div> |
| </td> |
| </tr> |
| <tr id="i14" class="altColor"> |
| <td class="colFirst"><code>static int</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#exactLog2OfLong(long)">exactLog2OfLong</a></span>​(long powerOf2)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the log2 of the given long value if it is an exact power of 2 and greater than zero.</div> |
| </td> |
| </tr> |
| <tr id="i15" class="rowColor"> |
| <td class="colFirst"><code>static int</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#exactLog2OfLong(long,java.lang.String)">exactLog2OfLong</a></span>​(long powerOf2, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> argName)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the log2 of the given long value if it is an exact power of 2 and greater than zero.</div> |
| </td> |
| </tr> |
| <tr id="i16" class="altColor"> |
| <td class="colFirst"><code>static double</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#floorPowerBaseOfDouble(double,double)">floorPowerBaseOfDouble</a></span>​(double base, |
| double n)</code></th> |
| <td class="colLast"> |
| <div class="block">Computes the floor power of given <i>base</i> and <i>n</i> as doubles.</div> |
| </td> |
| </tr> |
| <tr id="i17" class="rowColor"> |
| <td class="colFirst"><code>static int</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#floorPowerOf2(int)">floorPowerOf2</a></span>​(int n)</code></th> |
| <td class="colLast"> |
| <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="i18" class="altColor"> |
| <td class="colFirst"><code>static long</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#floorPowerOf2(long)">floorPowerOf2</a></span>​(long n)</code></th> |
| <td class="colLast"> |
| <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="i19" class="rowColor"> |
| <td class="colFirst"><code>static byte[]</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#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" class="externalLink">String</a> shortFileName)</code></th> |
| <td class="colLast"> |
| <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" class="externalLink">File</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#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" class="externalLink">String</a> shortFileName)</code></th> |
| <td class="colLast"> |
| <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" class="externalLink">String</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#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" class="externalLink">String</a> shortFileName)</code></th> |
| <td class="colLast"> |
| <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> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#intToBytes(int,byte%5B%5D)">intToBytes</a></span>​(int v, |
| byte[] arr)</code></th> |
| <td class="colLast"> |
| <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> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#invPow2(int)">invPow2</a></span>​(int e)</code></th> |
| <td class="colLast"> |
| <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> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isEven(long)">isEven</a></span>​(long n)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns true if given n is even.</div> |
| </td> |
| </tr> |
| <tr id="i25" class="rowColor"> |
| <td class="colFirst"><code>static boolean</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isIntPowerOf2(int)">isIntPowerOf2</a></span>​(int powerOf2)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns true if given int argument is exactly a positive power of 2 and greater than zero.</div> |
| </td> |
| </tr> |
| <tr id="i26" class="altColor"> |
| <td class="colFirst"><code>static boolean</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isLessThanUnsigned(long,long)">isLessThanUnsigned</a></span>​(long n1, |
| long n2)</code></th> |
| <td class="colLast"> |
| <div class="block">Unsigned compare with longs.</div> |
| </td> |
| </tr> |
| <tr id="i27" class="rowColor"> |
| <td class="colFirst"><code>static boolean</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isLongPowerOf2(long)">isLongPowerOf2</a></span>​(long powerOf2)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns true if given long argument is exactly a positive power of 2 and greater than zero.</div> |
| </td> |
| </tr> |
| <tr id="i28" class="altColor"> |
| <td class="colFirst"><code>static boolean</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isMultipleOf8AndGT0(long)">isMultipleOf8AndGT0</a></span>​(long v)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns true if v is a multiple of 8 and greater than zero</div> |
| </td> |
| </tr> |
| <tr id="i29" class="rowColor"> |
| <td class="colFirst"><code>static boolean</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isOdd(long)">isOdd</a></span>​(long n)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns true if given n is odd.</div> |
| </td> |
| </tr> |
| <tr id="i30" class="altColor"> |
| <td class="colFirst"><code>static double</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#log2(double)">log2</a></span>​(double value)</code></th> |
| <td class="colLast"> |
| <div class="block">The log base 2 of the value</div> |
| </td> |
| </tr> |
| <tr id="i31" class="rowColor"> |
| <td class="colFirst"><code>static double</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#logBaseOfX(double,double)">logBaseOfX</a></span>​(double logBase, |
| double x)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the logarithm_logBase of x.</div> |
| </td> |
| </tr> |
| <tr id="i32" class="altColor"> |
| <td class="colFirst"><code>static byte[]</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#longToBytes(long,byte%5B%5D)">longToBytes</a></span>​(long v, |
| byte[] arr)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns a Little-Endian byte array extracted from the given long.</div> |
| </td> |
| </tr> |
| <tr id="i33" 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" class="externalLink">String</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#longToHexBytes(long)">longToHexBytes</a></span>​(long v)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns a string of spaced hex bytes in Big-Endian order.</div> |
| </td> |
| </tr> |
| <tr id="i34" 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" class="externalLink">String</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#milliSecToString(long)">milliSecToString</a></span>​(long mS)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the given time in milliseconds formatted as Hours:Min:Sec.mSec</div> |
| </td> |
| </tr> |
| <tr id="i35" 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" class="externalLink">String</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#nanoSecToString(long)">nanoSecToString</a></span>​(long nS)</code></th> |
| <td class="colLast"> |
| <div class="block">Returns the given time in nanoseconds formatted as Sec.mSec_uSec_nSec</div> |
| </td> |
| </tr> |
| <tr id="i36" class="altColor"> |
| <td class="colFirst"><code>static int</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#numberOfLeadingOnes(long)">numberOfLeadingOnes</a></span>​(long v)</code></th> |
| <td class="colLast"> |
| <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="i37" class="rowColor"> |
| <td class="colFirst"><code>static int</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#numberOfTrailingOnes(long)">numberOfTrailingOnes</a></span>​(long v)</code></th> |
| <td class="colLast"> |
| <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="i38" class="altColor"> |
| <td class="colFirst"><code>static double</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#powerSeriesNextDouble(int,double,boolean,double)">powerSeriesNextDouble</a></span>​(int ppb, |
| double curPoint, |
| boolean roundToLong, |
| double logBase)</code></th> |
| <td class="colLast"> |
| <div class="block">Computes the next larger double in the power series |
| <i>point = logBase<sup>( i / ppb )</sup></i> given the current point in the series.</div> |
| </td> |
| </tr> |
| <tr id="i39" class="rowColor"> |
| <td class="colFirst"><code>static long</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#pwr2SeriesNext(int,long)">pwr2SeriesNext</a></span>​(int ppo, |
| long curPoint)</code></th> |
| <td class="colLast"> |
| <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="i40" class="altColor"> |
| <td class="colFirst"><code>static int</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#pwr2SeriesPrev(int,int)">pwr2SeriesPrev</a></span>​(int ppo, |
| int curPoint)</code></th> |
| <td class="colLast"> |
| <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="i41" 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" class="externalLink">String</a></code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#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" class="externalLink">String</a> s, |
| int fieldLength)</code></th> |
| <td class="colLast"> |
| <div class="block">Prepend the given string with zeros.</div> |
| </td> |
| </tr> |
| </table> |
| <ul class="blockList"> |
| <li class="blockList"><a id="methods.inherited.from.class.java.lang.Object"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from class 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" class="externalLink">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" class="externalLink">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" class="externalLink">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" class="externalLink">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" class="externalLink">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" class="externalLink">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" class="externalLink">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" class="externalLink">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" class="externalLink">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" class="externalLink">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" class="externalLink">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" class="externalLink">wait</a></code></li> |
| </ul> |
| </li> |
| </ul> |
| </section> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ============ FIELD DETAIL =========== --> |
| <section> |
| <ul class="blockList"> |
| <li class="blockList"><a id="field.detail"> |
| <!-- --> |
| </a> |
| <h3>Field Detail</h3> |
| <a id="LS"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>LS</h4> |
| <pre>public static final <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> LS</pre> |
| <div class="block">The java line separator character as a String.</div> |
| </li> |
| </ul> |
| <a id="TAB"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>TAB</h4> |
| <pre>public static final 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.common.Util.TAB">Constant Field Values</a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="LOG2"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>LOG2</h4> |
| <pre>public static final double LOG2</pre> |
| <div class="block">The natural logarithm of 2.0.</div> |
| </li> |
| </ul> |
| <a id="INVERSE_GOLDEN_U64"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>INVERSE_GOLDEN_U64</h4> |
| <pre>public static final long INVERSE_GOLDEN_U64</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.common.Util.INVERSE_GOLDEN_U64">Constant Field Values</a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="INVERSE_GOLDEN"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>INVERSE_GOLDEN</h4> |
| <pre>public static final double INVERSE_GOLDEN</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.common.Util.INVERSE_GOLDEN">Constant Field Values</a></dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="LONG_MAX_VALUE_AS_DOUBLE"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>LONG_MAX_VALUE_AS_DOUBLE</h4> |
| <pre>public static final 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.common.Util.LONG_MAX_VALUE_AS_DOUBLE">Constant Field Values</a></dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </section> |
| <!-- ============ METHOD DETAIL ========== --> |
| <section> |
| <ul class="blockList"> |
| <li class="blockList"><a id="method.detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a id="bytesToInt(byte[])"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>bytesToInt</h4> |
| <pre class="methodSignature">public static int bytesToInt​(byte[] 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 id="bytesToLong(byte[])"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>bytesToLong</h4> |
| <pre class="methodSignature">public static long bytesToLong​(byte[] 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 id="intToBytes(int,byte[])"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>intToBytes</h4> |
| <pre class="methodSignature">public static byte[] intToBytes​(int v, |
| byte[] 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 id="longToBytes(long,byte[])"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>longToBytes</h4> |
| <pre class="methodSignature">public static byte[] longToBytes​(long v, |
| byte[] 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 id="longToHexBytes(long)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>longToHexBytes</h4> |
| <pre class="methodSignature">public 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" class="externalLink">String</a> longToHexBytes​(long 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 id="bytesToString(byte[],boolean,boolean,java.lang.String)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>bytesToString</h4> |
| <pre class="methodSignature">public 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" class="externalLink">String</a> bytesToString​(byte[] arr, |
| boolean signed, |
| boolean 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" class="externalLink">String</a> 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 id="nanoSecToString(long)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>nanoSecToString</h4> |
| <pre class="methodSignature">public 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" class="externalLink">String</a> nanoSecToString​(long 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 id="milliSecToString(long)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>milliSecToString</h4> |
| <pre class="methodSignature">public 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" class="externalLink">String</a> milliSecToString​(long 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 id="zeroPad(java.lang.String,int)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>zeroPad</h4> |
| <pre class="methodSignature">public 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" class="externalLink">String</a> 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" class="externalLink">String</a> s, |
| int 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 id="characterPad(java.lang.String,int,char,boolean)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>characterPad</h4> |
| <pre class="methodSignature">public 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" class="externalLink">String</a> 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" class="externalLink">String</a> s, |
| int fieldLength, |
| char padChar, |
| boolean 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 id="checkIfMultipleOf8AndGT0(long,java.lang.String)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>checkIfMultipleOf8AndGT0</h4> |
| <pre class="methodSignature">public static void checkIfMultipleOf8AndGT0​(long 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" class="externalLink">String</a> 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 id="isMultipleOf8AndGT0(long)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isMultipleOf8AndGT0</h4> |
| <pre class="methodSignature">public static boolean isMultipleOf8AndGT0​(long 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 id="isIntPowerOf2(int)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isIntPowerOf2</h4> |
| <pre class="methodSignature">public static boolean isIntPowerOf2​(int powerOf2)</pre> |
| <div class="block">Returns true if given int argument is exactly a positive power of 2 and greater than zero.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>powerOf2</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 id="isLongPowerOf2(long)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isLongPowerOf2</h4> |
| <pre class="methodSignature">public static boolean isLongPowerOf2​(long powerOf2)</pre> |
| <div class="block">Returns true if given long argument is exactly a positive power of 2 and greater than zero.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>powerOf2</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 id="checkIfIntPowerOf2(int,java.lang.String)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>checkIfIntPowerOf2</h4> |
| <pre class="methodSignature">public static void checkIfIntPowerOf2​(int powerOf2, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> argName)</pre> |
| <div class="block">Checks the given int argument to make sure it is a positive power of 2 and greater than zero. |
| If not it throws an exception with the user supplied local argument name.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>powerOf2</code> - The input int argument must be a power of 2 and greater than zero.</dd> |
| <dd><code>argName</code> - Used in the thrown exception.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="SketchesArgumentException.html" title="class in org.apache.datasketches.common">SketchesArgumentException</a></code> - if not a power of 2 nor greater than zero.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="checkIfLongPowerOf2(long,java.lang.String)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>checkIfLongPowerOf2</h4> |
| <pre class="methodSignature">public static void checkIfLongPowerOf2​(long powerOf2, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> argName)</pre> |
| <div class="block">Checks the given long argument to make sure it is a positive power of 2 and greater than zero. |
| If not, it throws an exception with the user supplied local argument name.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>powerOf2</code> - The input long argument must be a power of 2 and greater than zero.</dd> |
| <dd><code>argName</code> - Used in the thrown exception.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="SketchesArgumentException.html" title="class in org.apache.datasketches.common">SketchesArgumentException</a></code> - if not a power of 2 nor greater than zero.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="ceilingIntPowerOf2(int)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>ceilingIntPowerOf2</h4> |
| <pre class="methodSignature">public static int ceilingIntPowerOf2​(int n)</pre> |
| <div class="block">Computes the int 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 ≤ 1: returns 1</li> |
| <li>2^30 ≤ n ≤ 2^31 -1 : returns 2^30</li> |
| <li>n == an exact power of 2 : returns n</li> |
| <li>otherwise returns the smallest power of 2 ≥ n and equal to a mathematical integer</li> |
| </ul></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>n</code> - The input int argument.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the ceiling power of 2.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="ceilingLongPowerOf2(long)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>ceilingLongPowerOf2</h4> |
| <pre class="methodSignature">public static long ceilingLongPowerOf2​(long n)</pre> |
| <div class="block">Computes the long 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 ≤ 1: returns 1</li> |
| <li>2^62 ≤ n ≤ 2^63 -1 : returns 2^62</li> |
| <li>n == an exact power of 2 : returns n</li> |
| <li>otherwise returns the smallest power of 2 ≥ n and equal to a mathematical integer</li> |
| </ul></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>n</code> - The input long argument.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the ceiling power of 2.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="floorPowerOf2(int)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>floorPowerOf2</h4> |
| <pre class="methodSignature">public static int floorPowerOf2​(int 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 ≤ 1: returns 1</li> |
| <li>2^30 ≤ n ≤ 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 id="floorPowerOf2(long)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>floorPowerOf2</h4> |
| <pre class="methodSignature">public static long floorPowerOf2​(long 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 ≤ 1: returns 1</li> |
| <li>2^62 ≤ n ≤ 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 id="invPow2(int)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>invPow2</h4> |
| <pre class="methodSignature">public static double invPow2​(int 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 id="pwr2SeriesNext(int,long)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>pwr2SeriesNext</h4> |
| <pre class="methodSignature">public static long pwr2SeriesNext​(int ppo, |
| long 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 <= 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 ≥ 1.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the next point in the power series.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="pwr2SeriesPrev(int,int)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>pwr2SeriesPrev</h4> |
| <pre class="methodSignature">public static int pwr2SeriesPrev​(int ppo, |
| int 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 >= 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 ≥ 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 id="powerSeriesNextDouble(int,double,boolean,double)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>powerSeriesNextDouble</h4> |
| <pre class="methodSignature">public static double powerSeriesNextDouble​(int ppb, |
| double curPoint, |
| boolean roundToLong, |
| double logBase)</pre> |
| <div class="block">Computes the next larger double in the power series |
| <i>point = logBase<sup>( i / ppb )</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 ppb = 2; |
| double logBase = 2.0; |
| |
| for (double p = minP; p <= maxP; p = powerSeriesNextDouble(ppb, p, true, logBase)) { |
| 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>ppb</code> - Points-Per-Base, or the number of points per integer powers of base in the series.</dd> |
| <dd><code>curPoint</code> - the current point of the series. Must be ≥ 1.0.</dd> |
| <dd><code>roundToLong</code> - if true the output will be rounded to the nearest long.</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 id="ceilingPowerBaseOfDouble(double,double)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>ceilingPowerBaseOfDouble</h4> |
| <pre class="methodSignature">public static double ceilingPowerBaseOfDouble​(double base, |
| double n)</pre> |
| <div class="block">Computes the ceiling power of given <i>base</i> and <i>n</i> as doubles. |
| This is the smallest positive power |
| of <i>base</i> that equal to or greater than the given <i>n</i> and equal to a mathematical integer. |
| The result of this function is consistent with <a href="#ceilingIntPowerOf2(int)"><code>ceilingIntPowerOf2(int)</code></a> for values |
| less than one. I.e., if <i>n < 1,</i> the result is 1.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>base</code> - The base in the expression ⌈base<sup>n</sup>⌉.</dd> |
| <dd><code>n</code> - The input argument.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the ceiling power of <i>base</i> as a double and equal to a mathematical integer.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="floorPowerBaseOfDouble(double,double)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>floorPowerBaseOfDouble</h4> |
| <pre class="methodSignature">public static double floorPowerBaseOfDouble​(double base, |
| double n)</pre> |
| <div class="block">Computes the floor power of given <i>base</i> and <i>n</i> as doubles. |
| This is the largest positive power |
| of <i>base</i> 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="#floorPowerOf2(int)"><code>floorPowerOf2(int)</code></a> for values |
| less than one. I.e., if <i>n < 1,</i> the result is 1.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>base</code> - The base in the expression ⌊base<sup>n</sup>⌋.</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 id="log2(double)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>log2</h4> |
| <pre class="methodSignature">public static double log2​(double 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 id="logBaseOfX(double,double)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>logBaseOfX</h4> |
| <pre class="methodSignature">public static double logBaseOfX​(double logBase, |
| double 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 id="numberOfTrailingOnes(long)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>numberOfTrailingOnes</h4> |
| <pre class="methodSignature">public static int numberOfTrailingOnes​(long 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 id="numberOfLeadingOnes(long)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>numberOfLeadingOnes</h4> |
| <pre class="methodSignature">public static int numberOfLeadingOnes​(long 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 id="exactLog2OfInt(int,java.lang.String)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>exactLog2OfInt</h4> |
| <pre class="methodSignature">public static int exactLog2OfInt​(int powerOf2, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> argName)</pre> |
| <div class="block">Returns the log2 of the given int value if it is an exact power of 2 and greater than zero. |
| If not, it throws an exception with the user supplied local argument name.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>powerOf2</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 log2 of the given value if it is an exact power of 2 and greater than zero.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="SketchesArgumentException.html" title="class in org.apache.datasketches.common">SketchesArgumentException</a></code> - if not a power of 2 nor greater than zero.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="exactLog2OfLong(long,java.lang.String)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>exactLog2OfLong</h4> |
| <pre class="methodSignature">public static int exactLog2OfLong​(long powerOf2, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a> argName)</pre> |
| <div class="block">Returns the log2 of the given long value if it is an exact power of 2 and greater than zero. |
| If not, it throws an exception with the user supplied local argument name.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>powerOf2</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 log2 of the given value if it is an exact power of 2 and greater than zero.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="SketchesArgumentException.html" title="class in org.apache.datasketches.common">SketchesArgumentException</a></code> - if not a power of 2 nor greater than zero.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="exactLog2OfInt(int)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>exactLog2OfInt</h4> |
| <pre class="methodSignature">public static int exactLog2OfInt​(int powerOf2)</pre> |
| <div class="block">Returns the log2 of the given int value if it is an exact power of 2 and greater than zero. |
| If not, it throws an exception.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>powerOf2</code> - must be a power of 2 and greater than zero.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the log2 of the given int value if it is an exact power of 2 and greater than zero.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="exactLog2OfLong(long)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>exactLog2OfLong</h4> |
| <pre class="methodSignature">public static int exactLog2OfLong​(long powerOf2)</pre> |
| <div class="block">Returns the log2 of the given long value if it is an exact power of 2 and greater than zero. |
| If not, it throws an exception.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>powerOf2</code> - must be a power of 2 and greater than zero.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>the log2 of the given long value if it is an exact power of 2 and greater than zero.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="checkBounds(long,long,long)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>checkBounds</h4> |
| <pre class="methodSignature">public static void checkBounds​(long reqOff, |
| long reqLen, |
| long allocSize)</pre> |
| <div class="block">Check the requested offset and length against the allocated size. |
| The invariants equation is: <code>0 <= reqOff <= reqLen <= reqOff + reqLen <= allocSize</code>. |
| If this equation is violated an <a href="SketchesArgumentException.html" title="class in org.apache.datasketches.common"><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 id="checkProbability(double,java.lang.String)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>checkProbability</h4> |
| <pre class="methodSignature">public static void checkProbability​(double 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" class="externalLink">String</a> 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 id="isLessThanUnsigned(long,long)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isLessThanUnsigned</h4> |
| <pre class="methodSignature">public static boolean isLessThanUnsigned​(long n1, |
| long 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 > n2.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="isEven(long)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isEven</h4> |
| <pre class="methodSignature">public static boolean isEven​(long n)</pre> |
| <div class="block">Returns true if given n is even.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>n</code> - the given n</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>true if given n is even.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="isOdd(long)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>isOdd</h4> |
| <pre class="methodSignature">public static boolean isOdd​(long n)</pre> |
| <div class="block">Returns true if given n is odd.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>n</code> - the given n</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>true if given n is odd.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="getResourcePath(java.lang.String)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getResourcePath</h4> |
| <pre class="methodSignature">public 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" class="externalLink">String</a> 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" class="externalLink">String</a> 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 id="getResourceFile(java.lang.String)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getResourceFile</h4> |
| <pre class="methodSignature">public 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" class="externalLink">File</a> 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" class="externalLink">String</a> 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 id="getResourceBytes(java.lang.String)"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>getResourceBytes</h4> |
| <pre class="methodSignature">public static byte[] 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" class="externalLink">String</a> 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> |
| </li> |
| </ul> |
| </section> |
| </li> |
| </ul> |
| </div> |
| </div> |
| </main> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <footer role="contentinfo"> |
| <nav role="navigation"> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a id="navbar.bottom"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <a id="navbar.bottom.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../index.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" id="allclasses_navbar_bottom"> |
| <li><a href="../../../../allclasses.html">All 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> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </li> |
| <li><a href="#field.summary">Field</a> | </li> |
| <li>Constr | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li><a href="#field.detail">Field</a> | </li> |
| <li>Constr | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a id="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| </nav> |
| <p class="legalCopy"><small>Copyright © 2015–2022 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p> |
| </footer> |
| </body> |
| </html> |