List of usage examples for java.lang StringBuffer append
@Override public synchronized StringBuffer append(double d)
From source file:Main.java
public static String formatNumber(int number, int length) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < length; i++) { sb.append("0"); }/*from w ww . j a v a 2s .co m*/ java.text.DecimalFormat format = new java.text.DecimalFormat(sb.toString()); return format.format(number); }
From source file:Main.java
public static boolean isAccessibilityServiceOn(Context context, String packageName, String className) { ArrayList<String> allAccessibilityServices = getAllAccessibilityServices(context); StringBuffer concat = new StringBuffer(); concat.append(packageName); concat.append('/'); concat.append(className);//from w w w . j a va 2 s . co m return allAccessibilityServices.contains(concat.toString()); }
From source file:Main.java
/** * * @param len//from w w w .ja v a 2s. com * @return */ public static String getRandomHex(int len) { Random r = new Random(); StringBuffer sb = new StringBuffer(); while (sb.length() < len) { sb.append(Integer.toHexString(r.nextInt())); } return sb.toString().substring(0, len).toUpperCase(); }
From source file:Main.java
/** * Transforms a byte array in a hex string * // w w w . j ava 2 s. co m * @param digest * Digest * @return Display ready string */ public static String ToHexString(byte[] digest) { StringBuffer hexStr = new StringBuffer(40); for (byte b : digest) { hexStr.append(Integer.toString((b & 0xff) + 0x100, 16).substring(1)); } return hexStr.toString(); }
From source file:Main.java
public static String generateRandomString(int len) { String all = "0123456789abcdefghijklmnopqrstuvwxyz"; StringBuffer s = new StringBuffer(); for (int i = 0; i < len; i++) { s.append(all.charAt(getRandomNum(36))); }// w w w . j a v a2 s . com return s.toString(); }
From source file:Main.java
public static String createSearachkeyHtml(String template, List<String> list) { StringBuffer bf = new StringBuffer(); for (String searchkey : list) { bf.append("<a onclick=\"searchkey('" + searchkey + "')\" href=\"#\">").append(searchkey) .append("</a>\n"); }// w w w .j av a2 s . c om return template.replace(SEARCHKEY_TAG, bf.toString()); }
From source file:Main.java
public static String convertListToURLParamsString(List<?> values) { StringBuffer buff = new StringBuffer(); for (Object object : values) { buff.append(object.toString() + "&"); }/*w ww . j av a2 s . c o m*/ buff.replace(buff.length() - 1, buff.length(), ""); return buff.toString(); }
From source file:MainClass.java
public static String remainingElements(int low, int high) { StringBuffer temporary = new StringBuffer(); for (int i = 0; i < low; i++) temporary.append(" "); for (int i = low; i <= high; i++) temporary.append(data[i] + " "); temporary.append("\n"); return temporary.toString(); }
From source file:Main.java
public static String getStringByStringBuffer(String... strings) { StringBuffer builder = new StringBuffer(); for (String string : strings) { builder.append(string); }//from ww w . j a v a2 s . c o m return builder.toString(); }
From source file:Main.java
public static String processAsteriskLabel(String labelString) { if (labelString == null) { return null; }/*w w w . j a v a 2 s. c om*/ StringBuffer sb = new StringBuffer(""); sb.append("<html><body> "); int index = labelString.lastIndexOf("*"); if (index > -1) { sb.append(labelString.subSequence(0, index)); sb.append("<font color='red'>*</font>"); } else { sb.append(labelString + " "); } sb.append("</body></html>"); return sb.toString(); }