public class

Longs

extends Object
java.lang.Object
   ↳ com.pnfsoftware.jeb.util.primitives.Longs

Class Overview

Utility methods for longs.

Summary

Public Constructors
Longs()
Public Methods
static int compareUnsigned(long x, long y)
Compare two longs as unsigned.
static long divUnsigned(long dividend, long divisor)
Divide two longs treated as unsigned.
static boolean equals(Long a, long b)
Safe equality.
static boolean equals(Long a, Long b)
Safe equality.
static boolean equals(long a, Long b)
Safe equality.
static String formatHexCollection(Collection<Long> list)
Uses a "0x" prefix, ", " separator.
static String formatLongCollection(Collection<Long> collection, Integer radix, String pfx, String sfx, String separator)
Format a collection of longs.
static long fromInts(int v0, int v1)
Create a long from two ints.
static long maxUnsigned(long x, long y)
Retrieve the max of two longs treated as unsigned.
static long minUnsigned(long x, long y)
Retrieve the min of two longs treated as unsigned.
static Iterable<Long> range(long start, long end, long step)
Generate an iterable range of integers.
static Iterable<Long> range(long cnt)
Generate an incremental range of integers from 0 to the provided count.
static Iterable<Long> range(long start, long end)
Generate an incremental range of integers.
static long remUnsigned(long dividend, long divisor)
Get the division remainder of two longs treated as unsigned.
static int[] toInts(long v)
Create two ints from a long.
static BigInteger toUnsignedBigInteger(long v)
Convert a long treated as unsigned to a big integer.
static String toUnsignedString(long value)
Convert a long to its unsigned decimal string representation.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Longs ()

Public Methods

public static int compareUnsigned (long x, long y)

Compare two longs as unsigned.

public static long divUnsigned (long dividend, long divisor)

Divide two longs treated as unsigned.

public static boolean equals (Long a, long b)

Safe equality.

Parameters
a may be null
Returns
  • true if a is not null and its long value equal to b

public static boolean equals (Long a, Long b)

Safe equality.

Parameters
a may be null
b may be null
Returns
  • true if both a and b are null or if their long values are equal

public static boolean equals (long a, Long b)

Safe equality.

Parameters
b may be null
Returns
  • true if b is not null and its long value equal to a

public static String formatHexCollection (Collection<Long> list)

Uses a "0x" prefix, ", " separator.

public static String formatLongCollection (Collection<Long> collection, Integer radix, String pfx, String sfx, String separator)

Format a collection of longs.

Parameters
collection collection of longs
radix optional, default=10
pfx optional, default=none
sfx optional, default=none
separator optional, default=", "

public static long fromInts (int v0, int v1)

Create a long from two ints. See toInts(long) for the reverse operation.

public static long maxUnsigned (long x, long y)

Retrieve the max of two longs treated as unsigned.

public static long minUnsigned (long x, long y)

Retrieve the min of two longs treated as unsigned.

public static Iterable<Long> range (long start, long end, long step)

Generate an iterable range of integers.

Parameters
end exclusive
step increment (can be negative, cannot be zero)

public static Iterable<Long> range (long cnt)

Generate an incremental range of integers from 0 to the provided count.

public static Iterable<Long> range (long start, long end)

Generate an incremental range of integers.

Parameters
end exclusive

public static long remUnsigned (long dividend, long divisor)

Get the division remainder of two longs treated as unsigned.

public static int[] toInts (long v)

Create two ints from a long. See fromInts(int, int) for the reverse operation.

Returns
  • an array of two ints.

public static BigInteger toUnsignedBigInteger (long v)

Convert a long treated as unsigned to a big integer.

public static String toUnsignedString (long value)

Convert a long to its unsigned decimal string representation.