List of usage examples for java.lang StringBuilder append
@Override public StringBuilder append(double d)
From source file:MD5StringUtil.java
public static String md5StringFor(String s) { final byte[] hash = digest.digest(s.getBytes()); final StringBuilder builder = new StringBuilder(); for (byte b : hash) { builder.append(Integer.toString(b & 0xFF, 16)); }/* w w w.j a v a2 s . c o m*/ return builder.toString(); }
From source file:Main.java
public static String getStringByStringBuilder(String... strings) { StringBuilder builder = new StringBuilder(); for (String string : strings) { builder.append(string); }//from w w w .ja v a 2 s . com return builder.toString(); }
From source file:Main.java
public static String serializeList(List<String> data) { StringBuilder builder = new StringBuilder(); for (String entry : data) { builder.append(entry); builder.append(DELIMITER);/*from w w w. j av a2s . c o m*/ } return builder.toString(); }
From source file:Main.java
private static String printList(List<Long> list) { StringBuilder sb = new StringBuilder(); for (Long id : list) { sb.append(id + whiteSpace); }//from w w w .ja v a2 s.c om return sb.toString(); }
From source file:Main.java
public static String random(String src) { String[] srcList = src.split(""); List<String> list = Arrays.asList(srcList); Collections.shuffle(list);//w w w . j a v a 2 s. c o m StringBuilder result = new StringBuilder(); for (String i : list) { result.append(i); } return result.toString(); }
From source file:Main.java
public static String printBundle(Bundle bundle) { StringBuilder sb = new StringBuilder(); for (String key : bundle.keySet()) { sb.append("\nkey:" + key + ", value:" + bundle.getString(key)); }//from ww w . ja v a 2 s .c o m return sb.toString(); }
From source file:Main.java
private static void appendXXX(int i, StringBuilder toAppendTo) { if (i < 100) toAppendTo.append('0'); appendXX(i, toAppendTo);// w w w.j av a 2s . c o m }
From source file:Main.java
public static String revWords(String str) { StringBuilder sb = new StringBuilder(); String revd = revStr(str);//from www. j a v a 2s.co m for (String s : revd.split(" ")) { sb.append(revStr(s)); sb.append(" "); } return sb.toString(); }
From source file:Main.java
private static String buildPOSTData(long stopCode, int daysInAdvance, Object timeInAdvance, int departureCount) { String time = ""; if (timeInAdvance != null) { if (timeInAdvance instanceof Date) time = advanceTimeFormat.format(timeInAdvance); else//from w ww . jav a 2 s . com time = timeInAdvance.toString(); } else { daysInAdvance = 0; } StringBuilder sb = new StringBuilder(); sb.append("googleMapMode=0"); sb.append("&busStopCode=").append(stopCode); sb.append("&busStopDay=").append(daysInAdvance); sb.append("&busStopTime=").append(time); sb.append("&nbDeparture=").append(departureCount); return sb.toString(); }
From source file:Main.java
public static String shortName(InetAddress hostname) { if (hostname == null) return null; StringBuilder sb = new StringBuilder(); if (resolve_dns) sb.append(hostname.getHostName()); else//from ww w. j av a 2 s .c o m sb.append(hostname.getHostAddress()); return sb.toString(); }