public class

Integers

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

Class Overview

Utility methods for ints

Summary

Public Constructors
Integers()
Public Methods
static String formatHexIntegerCollection(Collection<Integer> list)
Format a collection of ints.
static String formatIntegerCollection(Collection<Integer> collection, Integer radix, String pfx, String sfx)
Format a collection of ints.
static String formatIntegerCollection(Collection<Integer> collection, Integer radix, String pfx, String sfx, String separator)
static Integer max(Collection<Integer> c)
static Integer min(Collection<Integer> c)
static Iterable<Integer> range(int cnt)
Generate an incremental range of integers from 0 to the provided count.
static Iterable<Integer> range(int start, int end, int step)
Generate an iterable range of integers.
static Iterable<Integer> range(int start, int end)
Generate an incremental range of integers.
static int safeInt(Integer v)
Safe unbox an Integer to zero when null.
static Integer safeInt(Integer v, int defaultValue)
Safe unbox an Integer to defaultValue when null.
static String toUnsignedString(int value)
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Integers ()

Public Methods

public static String formatHexIntegerCollection (Collection<Integer> list)

Format a collection of ints.

public static String formatIntegerCollection (Collection<Integer> collection, Integer radix, String pfx, String sfx)

Format a collection of ints.

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

Parameters
radix optional, default=10
pfx optional, default=none
sfx optional, default=none

public static Integer max (Collection<Integer> c)

public static Integer min (Collection<Integer> c)

public static Iterable<Integer> range (int cnt)

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

public static Iterable<Integer> range (int start, int end, int step)

Generate an iterable range of integers.

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

public static Iterable<Integer> range (int start, int end)

Generate an incremental range of integers.

Parameters
end exclusive

public static int safeInt (Integer v)

Safe unbox an Integer to zero when null.

Parameters
v an Integer object
Returns
  • the integer value, 0 if null

public static Integer safeInt (Integer v, int defaultValue)

Safe unbox an Integer to defaultValue when null.

Parameters
v an Integer object
defaultValue default value if null
Returns
  • the integer value, defaultValue if null

public static String toUnsignedString (int value)