List of usage examples for java.lang Math round
public static long round(double a)
From source file:Main.java
public static java.util.Date sqlTimestampToDate(Timestamp t) { return t != null ? new java.util.Date(Math.round((double) t.getTime() + (double) t.getNanos() / 1000000D)) : null;/*from ww w.ja v a 2s . c o m*/ }
From source file:Main.java
public static int px2dp(Context context, int px) { int dp = Math.round(px / getPixelScaleFactor(context)); return dp;//from ww w. java2 s .com }
From source file:Main.java
public static int dpToPx(Context context, int dp) { return Math.round(dp * getPixelScaleFactor(context)); }
From source file:Main.java
public static int getDip(Context context, int resId) { return Math.round(context.getResources().getDimension(resId)); }
From source file:Main.java
public static int pxToDp(Context context, int px) { return Math.round(px / getPixelScaleFactor(context)); }
From source file:Main.java
public static void round(RectF rect) { rect.left = Math.round(rect.left); rect.right = Math.round(rect.right); rect.top = Math.round(rect.top); rect.bottom = Math.round(rect.bottom); }
From source file:Main.java
public static Bitmap scaleBitmap(Bitmap bitmap, float pct) { return Bitmap.createScaledBitmap(bitmap, Math.round(bitmap.getWidth() * pct), Math.round(bitmap.getHeight() * pct), true); }
From source file:Main.java
public static double roundNumber(double rowNumber, int roundingPoint) { double base = Math.pow(10D, roundingPoint); return (double) Math.round(rowNumber * base) / base; }
From source file:Main.java
public static void multiply(final int[] pArray, final float pFactor) { for (int i = 0; i < pArray.length; i++) { pArray[i] = Math.round(pArray[i] * pFactor); }//from w w w. ja va2s.com }
From source file:Main.java
public static String cm2FT_IN(float paramFloat) { int i = (int) (paramFloat / 30.48F); int j = Math.round(12.0F * (paramFloat / 30.48F - i)); return i + "'" + j + "\""; }