List of usage examples for java.lang Math round
public static long round(double a)
From source file:Main.java
private static int getGlucose(byte[] bytes) { return (int) Math.round(((256 * (bytes[0] & 0xFF) + (bytes[1] & 0xFF)) & 0x0FFF) / 8.5); }
From source file:Main.java
public static float myround2(float paramFloat) { return (float) (Math.round(100.0F * paramFloat) / 100.0D); }
From source file:Main.java
public static String randNum(long dig, long len) { String number;//from ww w . j av a 2s.c o m int num = (int) Math.abs((Math.round(Math.random() * dig) + len)); number = Integer.toString(num); return number; }
From source file:Main.java
public static int getNumberOfThread() { final float scaleFactor = 1.7f; final int maxThread = Math.round(Runtime.getRuntime().availableProcessors() * scaleFactor); return maxThread; }
From source file:Main.java
public static float getRoundFolat3(double d) { return (float) ((Math.round(d * 1000)) / 1000.0); }
From source file:Main.java
public static float getRoundFolat2(double d) { return (float) ((Math.round(d * 100)) / 100.0); }
From source file:Main.java
public static float getRoundFolat1(double d) { return (float) ((Math.round(d * 10)) / 10.0); }
From source file:Main.java
public static float kelvinToCelsius(float temperature) { float cels = temperature - 273.15f; return Math.round(cels * 10) / 10; }
From source file:Main.java
public static int getColor(int baseColor, float alphaPercent) { int alpha = Math.round((float) Color.alpha(baseColor) * alphaPercent); return baseColor & 16777215 | alpha << 24; }
From source file:Main.java
public static int getPixelsFromDip(float dips, Resources res) { return Math.round(dips * res.getDisplayMetrics().density); }