1 4 5 9 10 package org.openlaszlo.utils; 11 12 import java.lang.Math ; 13 16 17 public class MathUtils { 18 22 public static String formatDouble(double d, int n) { 23 int x = (int)Math.pow(10, n); 24 return Double.toString((double)(( (int)(x*d) ) / (double)x)); 25 26 } 27 28 31 public static String byteToHexString(byte b) { 32 int left = (int)( (b & 0xf0) >> 4 ); 33 int right = (int)( b & 0x0f ); 34 return Integer.toHexString(left) + Integer.toHexString(right); 35 } 36 } 37 38 | Popular Tags |