Java Primitive Type Create toPrimitiveInt(Integer value)

Here you can find the source of toPrimitiveInt(Integer value)

Description

Converts an object Integer to a primitive int.

License

Open Source License

Parameter

Parameter Description
value the <tt>Integer</tt> value

Return

0 if the given Integer value is null else integer value

Declaration

public static int toPrimitiveInt(Integer value) 

Method Source Code

//package com.java2s;
/**//from  www.j a  v a2 s  . c  o m
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License. See License.txt in the project root for
 * license information.
 */

public class Main {
    /**
     * Converts an object Integer to a primitive int.
     *
     * @param value the <tt>Integer</tt> value
     * @return <tt>0</tt> if the given Integer value is null else <tt>integer value</tt>
     */
    public static int toPrimitiveInt(Integer value) {
        if (value == null) {
            return 0;
        }
        return value;
    }
}

Related

  1. toPrimitiveBoolean(Object o)
  2. toPrimitiveBoolean(Object o)
  3. toPrimitiveByteArray(Integer[] array)
  4. toPrimitiveClass(Class wrapperClass)
  5. toPrimitiveDouble(Double d)
  6. toPrimitiveInt(Object o)
  7. toPrimitiveNumber(String s)
  8. toPrimitiveType(Class c)
  9. toPrimitiveType(Class cls)