List of usage examples for java.lang StringBuilder toString
@Override
@HotSpotIntrinsicCandidate
public String toString()
From source file:Main.java
public static byte[] hexStringToByteArray(String encoded) { if ((encoded.length() % 2) != 0) throw new IllegalArgumentException("Input string must contain an even number of characters"); final byte result[] = new byte[encoded.length() / 2]; final char enc[] = encoded.toCharArray(); for (int i = 0; i < enc.length; i += 2) { StringBuilder curr = new StringBuilder(2); curr.append(enc[i]).append(enc[i + 1]); result[i / 2] = (byte) Integer.parseInt(curr.toString(), 16); }/*from ww w .ja v a2 s .co m*/ return result; }
From source file:Main.java
public static <E> String collectionToString(Collection<E> collection, String prefix) { StringBuilder sb = new StringBuilder(); collectionToString(sb, collection, prefix, "[", ",", "]"); return sb.toString(); }
From source file:Main.java
public static String createCssTag(List<String> urls) { final StringBuilder sb = new StringBuilder(); for (String url : urls) { sb.append(createCssTag(url));/* www .jav a 2 s . co m*/ } return sb.toString(); }
From source file:Main.java
public static String bytesRangeToString(byte[] bytes, int from, int to) { StringBuilder stringBuilder = new StringBuilder(); for (int i = from; i <= to; i++) stringBuilder.append((char) bytes[i]); return stringBuilder.toString(); }
From source file:Main.java
public static String toString(Bundle paramBundle) { StringBuilder localStringBuilder = new StringBuilder("{"); if (paramBundle != null) { }//from w w w . j av a 2 s.co m localStringBuilder.append("}"); return localStringBuilder.toString(); }
From source file:Main.java
public static String IntToBitSetString(int value) { StringBuilder sb = new StringBuilder(); while (value > 0) { sb.append(value % 2);/*from w w w .ja v a 2 s. com*/ value = value >> 1; } return sb.toString(); }
From source file:Main.java
public static String getUuidStringFromByteArray(byte[] bytes) { StringBuilder buffer = new StringBuilder(); for (byte aByte : bytes) { buffer.append(String.format("%02x", aByte)); }//from w w w . ja v a 2 s .c om return buffer.toString(); }
From source file:Main.java
public static String escape(String text) { StringBuilder sb = new StringBuilder(); for (char c : text.toCharArray()) { escape(c, sb);//from w ww. ja v a2 s .co m } return sb.toString(); }
From source file:Main.java
private static String intJoin(int[] aArr, String sSep) { StringBuilder sbStr = new StringBuilder(); for (int i : aArr) { sbStr.append(i);/*from w w w.ja v a 2 s .c om*/ sbStr.append(sSep); } return sbStr.toString(); }
From source file:Main.java
public static String aniadeCabecera(StringBuilder documento) { if (documento.indexOf("<?xml version=\"1.0\"") != -1) //si tiene cabecera ni lo tocamos return documento.toString(); StringBuilder sb = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>").append(documento); return sb.toString(); }