List of usage examples for java.lang String valueOf
public static String valueOf(double d)
From source file:Main.java
public static String[] toString(Object[] objects) { String[] stringArray = new String[objects.length]; for (int index = 0; index < objects.length; index++) { stringArray[index] = String.valueOf(objects[index]); }/*ww w . j ava2s. c om*/ return stringArray; }
From source file:Main.java
/** * Convert rate from double./*w ww . j a v a 2 s . co m*/ * * @param value * the value * @return the string */ public static String convertRateFromDouble(double value) { return String.valueOf(round(value * 100, 2)); }
From source file:Main.java
public static Integer getViewablePeriod(String viewablePeriod) { String viewable = null;/*from w ww . j a va2 s . co m*/ if (viewablePeriod.substring(9, 10).equals(" ")) { viewable = String.valueOf((Integer.parseInt(viewablePeriod.substring(0, 4)) * 365) + (Integer.parseInt(viewablePeriod.substring(5, 7)) * 30) + Integer.parseInt(viewablePeriod.substring(8, 9))); } else if (viewablePeriod.substring(10, 11).equals(" ")) { viewable = String.valueOf((Integer.parseInt(viewablePeriod.substring(0, 4)) * 365) + (Integer.parseInt(viewablePeriod.substring(5, 7)) * 30) + Integer.parseInt(viewablePeriod.substring(8, 10))); } else if (viewablePeriod.substring(11, 12).equals(" ")) { viewable = String.valueOf((Integer.parseInt(viewablePeriod.substring(0, 4)) * 365) + (Integer.parseInt(viewablePeriod.substring(5, 7)) * 30) + Integer.parseInt(viewablePeriod.substring(8, 11))); } return Integer.valueOf(viewable); }
From source file:Main.java
private static String generateRandomCharacter() { final String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; final int length = alphabet.length(); Random random = new Random(); String randomChar = String.valueOf(alphabet.charAt(random.nextInt(length))); return randomChar; }
From source file:Main.java
public static String replaceString(String paramString, int paramInt) { char[] arrayOfChar = paramString.toCharArray(); int i = paramString.length(); for (int j = 0;; j++) { if (j >= paramInt) return String.valueOf(arrayOfChar); arrayOfChar[(-5 + (i - j))] = '*'; }/*from ww w . ja va 2 s. com*/ }
From source file:Main.java
public static int GetYear(boolean lastTwoDigitOnly) { Calendar now = Calendar.getInstance(); if (!lastTwoDigitOnly) return now.get(Calendar.YEAR); else/*from w w w .j a va 2s . c o m*/ return Integer.parseInt(String.valueOf(now.get(Calendar.YEAR)).substring(2, 4)); }
From source file:Main.java
public static String attributeToString(boolean att, boolean bad_Value) { return (att == bad_Value ? "?" : String.valueOf(att)); }
From source file:Main.java
public static String getFirstChar(String value) { if (value != null) { for (int i = 0; i < value.length(); i++) { char ch = value.charAt(i); if (Character.isLetter(ch)) { return String.valueOf(ch).toUpperCase(); }/*from w w w . ja v a 2s. co m*/ } } return String.valueOf(" "); }
From source file:Main.java
public static String getAmPmTimeString(int hr, int min) { boolean isAM = false; if (hr < 12) { isAM = true;/*ww w.j a va 2s. c o m*/ } else if (hr > 12) { hr -= 12; } String hrStr = String.valueOf(hr); String minStr = String.valueOf(min); String timeStr = String.valueOf(hr) + ":"; if (minStr.length() == 1) { minStr = "0" + minStr; } timeStr += minStr; if (isAM) { timeStr += " AM"; } else { timeStr += " PM"; } return timeStr; }
From source file:Main.java
public static String addCondition(String conditions, String key, String value) { if ((conditions == null) || (key == null) || (value == null) || (key == "") || (value == "")) return conditions; conditions = (new StringBuilder(String.valueOf(conditions))).append(" and ").append(key).append(" = '") .append(value).append("'").toString(); return conditions; }