List of usage examples for java.lang String valueOf
public static String valueOf(double d)
From source file:Main.java
public static int kgToML(float paramFloat) { BigDecimal localBigDecimal1 = new BigDecimal(String.valueOf(paramFloat)); BigDecimal localBigDecimal2 = new BigDecimal("63701"); BigDecimal localBigDecimal3 = new BigDecimal("65536"); return new BigDecimal(String.valueOf(localBigDecimal1.multiply(localBigDecimal2).doubleValue())) .divide(localBigDecimal3, 0, 4).intValue(); }
From source file:Main.java
public static String format(String format, Object targetObc) { String target = String.valueOf(targetObc); if (format != null && !format.equals("")) { if (format.contains("#")) { String head = format.substring(0, format.indexOf("#")); String body = format.substring(format.indexOf("#")); //String tail=format.substring(format.lastIndexOf("#")+1); StringBuilder result = new StringBuilder(head); int j = 0; for (int i = 0; i < target.length(); i++) { if (j > body.length() - 1) { j = 0;/*from w ww . ja v a2 s . co m*/ } String s = String.valueOf(body.charAt(j)); if ("#".equals(s)) { result.append(String.valueOf(target.charAt(i))); } else { result.append(String.valueOf(body.charAt(j))); //result.append(String.valueOf(target.charAt(i))); i--; } j++; } return result.toString(); } else { return target; } } else { return target; } }
From source file:Main.java
public static String roundUptoTwoDecimalUnits(String value) { return String.valueOf(new BigDecimal(value).setScale(2, RoundingMode.HALF_UP).doubleValue()); }
From source file:net.kahowell.xsd.fuzzer.XmlGenerator.java
private static void doPostModuleConfig(CommandLine commandLine, XmlGenerationOptions options, Injector injector) {//from w ww .j a v a2s . c om if (commandLine.hasOption("s")) { String[] strategies = commandLine.getOptionValues("s"); for (String strategy : strategies) { options.getStrategies().add(Strategy.valueOf(strategy)); } } if (injector.getInstance(Key.get(Boolean.class, Names.named("offline")))) { XmlOptions schemaOptions = injector .getInstance(Key.get(XmlOptions.class, Names.named("xml schema options"))); schemaOptions.remove(XmlOptions.COMPILE_DOWNLOAD_URLS); } }
From source file:Main.java
public static void checkArgument(boolean expression, Object errorMsg) { if (!expression) throw new IllegalArgumentException(String.valueOf(errorMsg)); }
From source file:Main.java
public static String numToK(int number) { if (number < 10000) { return String.valueOf(number); } else {//from ww w.j a v a 2 s . co m float value = number * 1.0f / 10000; StringBuffer sb = new StringBuffer(String.valueOf(value)); sb.append("K"); return sb.toString(); } }
From source file:Main.java
public static String setDate(DateTime posixDate) { return String.valueOf(posixDate.getMillis() / 1000L); }
From source file:Main.java
public static String parseDayOfMonth(int day) { if (day < 10) { return "0" + day; } else {//from ww w .j av a 2 s . c o m return String.valueOf(day); } }
From source file:Main.java
public static String getPrice(float price) { float mPrice = price / 100; if (mPrice == (int) mPrice) { return String.valueOf((int) mPrice); } else {// w w w .ja va 2s.c om return String.valueOf(mPrice); } }
From source file:Main.java
public static int factorial(int num) { Log.d("factorial", String.valueOf(num)); if (num == 0) return 0; else if (num == 1) return 1; else// ww w . j a v a 2 s . com return num * factorial(num - 1); }