Java Utililty Methods Primitive Type Create

List of utility methods to do Primitive Type Create

Description

The list of methods to do Primitive Type Create are organized into topic(s).

Method

int[]toPrimitive(Integer[] irri)
Converteste un vector de Integer in vector de int
int[] array = new int[irri.length];
for (int i = 0; i < array.length; i++) {
    array[i] = irri[i].intValue();
return array;
long[]toPrimitive(Long[] array)
to Primitive
if (array == null) {
    return null;
} else if (array.length == 0) {
    return EMPTY_LONG_ARRAY;
final long[] result = new long[array.length];
for (int i = 0; i < array.length; i++) {
    result[i] = array[i].longValue();
...
long[]toPrimitive(Long[] array)
Converts the array with Long elements to the array with long (primitive type).
if (array == null) {
    return null;
long[] result = new long[array.length];
for (int i = 0; i < array.length; i++) {
    result[i] = array[i] != null ? array[i] : 0L;
return result;
...
long[]toPrimitive(Long[] array)
Converts Long[] array to primitive
long[] toArray = (array == null) ? new long[0] : new long[array.length];
for (int i = 0; i < toArray.length; i++) {
    toArray[i] = array[i];
return toArray;
ObjecttoPrimitive(Object o)
to Primitive
if (o == null)
    return null;
Class<?> c = o.getClass();
if (c.isPrimitive())
    return o;
if (c.equals(Void.class))
    return o;
else if (c.equals(Boolean.class))
...
bytetoPrimitive(Object value)
Unwraps the Byte to retrieve the primitive byte.
return ((Byte) value).byteValue();
boolean[]toPrimitiveArray(Boolean[] a)
to Primitive Array
if (a == null)
    return EMPTY_BOOLEAN_P;
boolean[] A = new boolean[a.length];
for (int i = 0; i < a.length; ++i)
    A[i] = a[i];
return A;
byte[]toPrimitiveArray(Byte[] array)
to Primitive Array
if (array == null) {
    return null;
} else {
    byte[] result = new byte[array.length];
    for (int i = 0; i < array.length; i++) {
        result[i] = array[i];
    return result;
...
byte[]toPrimitiveArray(Byte[] bytes)
to Primitive Array
byte[] out = new byte[bytes.length];
for (int i = 0; i < bytes.length; i++) {
    out[i] = bytes[i];
return out;
int[]toPrimitiveArray(Integer[] array)
to Primitive Array
int[] result = new int[array.length];
for (int i = 0; i < array.length; i++)
    result[i] = (array[i] == null ? 0 : array[i]);
return result;