Here you can find the source of numToInt(Number n)
Parameter | Description |
---|---|
n | Number to convert |
public static Integer numToInt(Number n)
//package com.java2s; //License from project: Creative Commons License public class Main { /**//from www.j a v a2 s . co m * Converts a Number object into an Integer. Takes a cast and method call. * This provides a simple wrapper. * @param n Number to convert * @return Integer representation of n */ public static Integer numToInt(Number n) { return (Integer) (n.intValue()); } /** * Wrapper for {@link Utils.numToInt(Number)}. * @param o * @return * @see Utils.numToInt(Number) */ public static Integer numToInt(Object o) { if (o instanceof Number) { return numToInt((Number) o); } return null; } }