List of usage examples for java.lang Math round
public static long round(double a)
From source file:Main.java
public static String kelvinToCelcius(double kelvin) { return String.valueOf(Math.round(kelvin - 273.15)); }
From source file:Main.java
public static double samplesToMillis(long samples, int sampleRate) { return Math.round((float) samples / sampleRate * 1000); }
From source file:Main.java
private static int getMiddleValue(int prev, int next, float factor) { return Math.round((float) prev + (float) (next - prev) * factor); }
From source file:Main.java
private static String getFileRoundSize(long paramLong) { return String.valueOf(Math.round(10.0F * ((float) paramLong / 1024.0F)) / 10.0F); }
From source file:Main.java
private static String generateBrand() { Long result = Math.round(Math.random() * 2); switch (result.intValue()) { case 0:/*from ww w . j av a 2 s . c om*/ return "Heineken"; case 1: return "Grimbergen"; case 2: return "Kriek"; default: break; } return null; }
From source file:Main.java
public static String temperatureConverter(double temp) { final long roundedTemp = Math.round(temp); return Long.toString(roundedTemp); }
From source file:Main.java
public static int setAlpha0to1(int color, float alpha) { return color & 0x00FFFFFF | Math.round(0xFF * alpha) << 24; }
From source file:Main.java
public static int devicePixelToMraidPoint(int pixelSize, float scale) { int points = Math.round(pixelSize / scale); return points; }
From source file:Main.java
public static long calcBezier(float interpolatedTime, float p0, float p1, float p2) { return Math.round((Math.pow((1 - interpolatedTime), 2) * p0) + (2 * (1 - interpolatedTime) * interpolatedTime * p1) + (Math.pow(interpolatedTime, 2) * p2)); }
From source file:Main.java
public static int dp2px(Context context, float dp) { return Math.round(dp * context.getResources().getDisplayMetrics().density); }