List of usage examples for java.lang StringBuilder toString
@Override
@HotSpotIntrinsicCandidate
public String toString()
From source file:Main.java
public static String prettifyFingerprint(String fingerprint) { StringBuilder builder = new StringBuilder(fingerprint); builder.insert(8, " "); builder.insert(17, " "); builder.insert(26, " "); builder.insert(35, " "); return builder.toString(); }
From source file:Main.java
/** * @param sequencesRanges Sequences ranges, as {min1,max1,min2,max2,etc.}. * @return String representation of the specified sequences ranges. *///from w ww. java 2 s . co m public static String toStringSequencesRanges(final long... sequencesRanges) { StringBuilder sb = new StringBuilder(); appendStringSequencesRanges(sb, Integer.MAX_VALUE, sequencesRanges); return sb.toString(); }
From source file:Main.java
public static String toString(String prefix, Iterable<?> iterable) { StringBuilder sb = new StringBuilder(prefix).append(" [\n"); JOINER.appendTo(sb, iterable).append((iterable != null && !Iterables.isEmpty(iterable)) ? "\n]" : "]"); return sb.toString(); }
From source file:Main.java
/** Returns a WHERE clause assert equality of a field to a value. */ public static String getEqualityClause(String field, String value) { StringBuilder clause = new StringBuilder(); clause.append(field);//from w w w . ja va 2 s . c o m clause.append(" = "); DatabaseUtils.appendEscapedSQLString(clause, value); return clause.toString(); }
From source file:Main.java
public static String mergeHits(ArrayList<String> processedHits) { StringBuilder htmlBuilder = new StringBuilder(); for (String elem : processedHits) { htmlBuilder.append(elem);//from ww w . j a v a2s .c om htmlBuilder.append("<hr/>"); } return htmlBuilder.toString(); }
From source file:Main.java
public static String byteToBit(byte[] bytes) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < Byte.SIZE * bytes.length; i++) sb.append((bytes[i / Byte.SIZE] << i % Byte.SIZE & 0x80) == 0 ? '0' : '1'); return sb.toString(); }
From source file:Main.java
public static String bytesToHexString(byte[] data) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < data.length; ++i) { int val = data[i] & 0xFF; sb.append(String.format("%02x", val)); }//from ww w. j a v a 2 s . c om return sb.toString(); }
From source file:StringUtil.java
/** * generate string consists of random characters. * @param length length of generated string * @return string/*from w w w. j av a 2 s.c om*/ */ public static String randomString(int length) { StringBuilder b = new StringBuilder(); for (int i = 0; i < length; i++) { b.append(base.charAt(random.nextInt(base.length()))); } return b.toString(); }
From source file:Main.java
/** * Joins the elements in an input collection using a given separator. * * @param <A> Key type// w ww .j a v a 2 s. co m * @param collection Input collection * @param separator Separator * @return {@code String} representation of the input {@code collection} */ public static <A> String join(Collection<A> collection, String separator) { if (collection.isEmpty()) return ""; Iterator<A> it = collection.iterator(); StringBuilder out = new StringBuilder(); out.append(it.next()); while (it.hasNext()) out.append(separator).append(it.next()); return out.toString(); }
From source file:Main.java
public static String dumpJPEG(byte[] jpeg) { StringBuilder sb = new StringBuilder("jpeg "); if (jpeg == null) { sb.append("<null>"); } else {//from w ww. ja v a 2s.co m sb.append("length=" + jpeg.length); } return sb.toString(); }