Java Float to Long floatToLong(float f)

Here you can find the source of floatToLong(float f)

Description

float To Long

License

LGPL

Declaration

public static Long floatToLong(float f) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

public class Main {
    public static Long floatToLong(float f) {
        if (f >= Long.MIN_VALUE && f <= Long.MAX_VALUE) {
            return (long) f;
        }/* www . j av a2 s  . com*/
        return null;
    }

    public static long floatToLong(float f, long defaultValue) {
        if (f >= Long.MIN_VALUE && f <= Long.MAX_VALUE) {
            return (long) f;
        }
        return defaultValue;
    }
}

Related

  1. floatToLong(final float value)
  2. floatToLong(float[] values)