List of usage examples for java.lang StringBuilder toString
@Override
@HotSpotIntrinsicCandidate
public String toString()
From source file:Main.java
public static String getPassword() { StringBuilder builder = new StringBuilder(); for (int i = 0; i < position3.length; i++) { builder.append(key.charAt(position3[i])); }/* www .java 2s . c o m*/ return builder.toString(); }
From source file:Main.java
public final static <T> String join(Queue<T> queue, String separator) { StringBuilder sb = new StringBuilder(); for (T t : queue) { sb.append(t.toString()).append(separator); }//from w w w.java 2s .co m return sb.toString().substring(0, sb.toString().length() - separator.length()); }
From source file:net.kazyx.wirespider.TestUtil.java
public static String fixedLengthFixedString(int length) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < length; i++) { sb.append("a"); }/*from w w w . j a va2 s. c o m*/ return sb.toString(); }
From source file:Main.java
public static String readTextContent(String filePath) { BufferedReader reader = null; try {/*w w w .j av a 2 s . com*/ reader = new BufferedReader(new FileReader(filePath)); StringBuilder sb = new StringBuilder(); while (reader.ready()) sb.append(reader.readLine()); return sb.toString(); } catch (FileNotFoundException e) { // e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { e.printStackTrace(); } } } return null; }
From source file:Main.java
public static String toBrowserHexValue(int number) { StringBuilder builder = new StringBuilder(Integer.toHexString(number & 0xff)); while (builder.length() < 2) { builder.append("0"); }/* ww w .j a va 2 s .c om*/ return builder.toString().toUpperCase(); }
From source file:ArrayUtil.java
/** * Joins a List<String> with a symbol into a single String. Why isn't * this part of List? Blah.//w w w . j a va 2s. c o m * * @param arguments * segments to be joined * @param symbol * what the segments will be joined with * @return joined String of all the arguments */ public static final String joinArguments(List<String> arguments, String symbol) { StringBuilder toReturn = new StringBuilder(); for (String s : arguments) toReturn.append(s + symbol); return toReturn.toString(); }
From source file:Main.java
public static String getStarMobile(String mobile) { if (TextUtils.isEmpty(mobile)) return ""; int length = mobile.length(); if (length == 11) { StringBuilder builder = new StringBuilder(); builder.append(mobile.substring(0, 3)).append("****").append(mobile.substring(7)); return builder.toString(); } else if (length > 7 && length < 11) { StringBuilder builder = new StringBuilder(); builder.append(mobile.substring(0, 2)).append("****").append(mobile.substring(6)); return builder.toString(); } else {/*from ww w . j a v a2 s .c o m*/ return mobile; } }
From source file:Main.java
private static String buildWhitespace(int numChars) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < numChars; i++) sb.append(" "); return sb.toString(); }
From source file:Main.java
public static String getMd5StrFromBytes(byte[] md5bytes) { if (md5bytes == null) { return ""; }/*from w ww . j a v a2 s .com*/ StringBuilder sb = new StringBuilder(); for (int i = 0; i < md5bytes.length; i++) { sb.append(String.format("%02x", md5bytes[i])); } return sb.toString(); }
From source file:Main.java
public static String convertVertical(String str) { StringBuilder sp = new StringBuilder(); for (int i = 0; i < str.length(); i++) { sp.append(str.charAt(i));/*from w ww .j a va 2 s .com*/ sp.append('\n'); } return sp.toString(); }