Java Unsigned Number Create unsignedLessThan(long a, long b)

Here you can find the source of unsignedLessThan(long a, long b)

Description

Return true if a (interepted as an unsigned string of bits) is less than b (interpreted likewise)

License

Open Source License

Declaration

static boolean unsignedLessThan(long a, long b) 

Method Source Code

//package com.java2s;
/**//from  w ww  .  jav  a 2  s  .  co  m
 * Copyright 2012-2013 Johns Hopkins University HLTCOE. All rights reserved.
 * This software is released under the 2-clause BSD license.
 * See LICENSE in the project root directory.
 */

public class Main {
    /**
     * Return true if a (interepted as an unsigned string of bits) is less than
     * b (interpreted likewise)
     */
    static boolean unsignedLessThan(long a, long b) {
        long shifted_a = (a >>> 1);
        long shifted_b = (b >>> 1);
        return ((shifted_a == shifted_b) ? ((a & 1) < (b & 1)) : (shifted_a < shifted_b));
    }
}

Related

  1. unsignedIntToSignedByte(final int i)
  2. unsignedIntToString(int x)
  3. unsignedIntToString(int x, int radix)
  4. unsignedIntValue(byte[] data, int offset)
  5. unsignedLeb128Size(int value)
  6. unsignedLocalIntersect2by2(final short[] set1, final int length1, final short[] set2, final int length2, final short[] buffer)
  7. unsignedLocalIntersect2by2Cardinality(final short[] set1, final int length1, final short[] set2, final int length2)
  8. unsignedLong(byte b)
  9. unsignedLongToByteArray(final long value)