Java Float to Int floatToInt(float f)

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

Description

float To Int

License

Open Source License

Declaration

public static final int floatToInt(float f) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static final int floatToInt(float f) {
        int i = Math.round(f * 255);
        return (i > 255) ? 255 : i;
    }/*from   w w  w .j a  v  a  2 s  .c  o  m*/
}

Related

  1. floatToInt(float f, int defaultValue)
  2. floatToInt(float[] ints)
  3. floatToInt(float[] values)
  4. floatToInt(String flot)