List of usage examples for java.lang StringBuilder append
@Override public StringBuilder append(double d)
From source file:Main.java
private static final void appendByte(final StringBuilder sb, final byte b) { int v = UnsignedBytes.toInt(b); sb.append(HEX[v >>> 4]); sb.append(HEX[v & 15]);/*from w ww .j av a 2 s. c o m*/ }
From source file:com.callidusrobotics.droptables.exception.HtmlWebApplicationException.java
protected static String getMessage(Throwable cause, int statusCode) { StringBuilder builder = new StringBuilder(); builder.append("<html><head><title>"); builder.append(statusCode);/*from www . ja va2s. c om*/ builder.append(" Error</title></head><body><pre>"); builder.append(ExceptionUtils.getStackTrace(cause)); builder.append("</pre></body></html>"); return builder.toString(); }
From source file:com.microsoft.azure.shortcuts.resources.samples.PublicIpAddressesSample.java
private static void printPIP(PublicIpAddress pip) throws Exception { StringBuilder output = new StringBuilder(); output.append(String.format("Public IP ID: %s\n", pip.id())) .append(String.format("\tName: %s\n", pip.name())) .append(String.format("\tGroup: %s\n", pip.resourceGroup())) .append(String.format("\tRegion: %s\n", pip.region())) .append(String.format("\tIP Address: %s\n", pip.ipAddress())) .append(String.format("\tLeaf domain label: %s\n", pip.leafDomainLabel())) .append(String.format("\tFQDN: %s\n", ((pip.inner().getDnsSettings() != null) ? pip.inner().getDnsSettings().getFqdn() : "(none)"))); System.out.println(output.toString()); }
From source file:Main.java
public static String dupeString(String str, int repeats) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < repeats; i++) { sb.append(str); }// ww w . java2s. c o m return sb.toString(); }
From source file:Main.java
public static String formatDuration(Date begDate, Date endDate) { // TODO Auto-generated method stub StringBuilder builder = new StringBuilder(formatDate(begDate)); builder.append(" - "); builder.append(formatDate(endDate)); return builder.toString(); }
From source file:Main.java
public static String passwordEncoder(String params) { StringBuilder param = new StringBuilder(params); param.append("&@*#^%^%$&"); char[] md5 = md5Encoder(param.toString(), false).toCharArray(); if (md5.length == 32) { param.append(md5[5]).append(md5[1]).append(md5[11]).append(md5[8]).append(md5[18]).append(md5[30]) .append(md5[28]).append(md5[22]); }/*from w w w.j a v a2 s .c o m*/ return md5Encoder(param.toString(), false); }
From source file:Main.java
public static void appendCDdataElement(StringBuilder sb, String tagName, String value) { appendTagPre(sb, tagName);//w ww .ja v a2 s .co m sb.append("<![CDATA[").append(value).append("]]>"); appendTagPost(sb, tagName); }
From source file:Main.java
public static String toHexString(int[] data) { if (data == null) return "null"; StringBuilder stringBuilder = new StringBuilder(data.length * 5); stringBuilder.append('['); for (int i = 0; i < data.length; i++) { stringBuilder.append(String.format("0x%02X", data[i])); if (i + 1 < data.length) stringBuilder.append(", "); }//from w w w. ja v a2s. c o m return stringBuilder.append(']').toString(); }
From source file:Main.java
public static String toHexString(byte[] data) { if (data == null) return "null"; StringBuilder stringBuilder = new StringBuilder(data.length * 5); stringBuilder.append('['); for (int i = 0; i < data.length; i++) { stringBuilder.append(String.format("0x%02X", data[i])); if (i + 1 < data.length) stringBuilder.append(", "); }//w w w. ja va2s . co m return stringBuilder.append(']').toString(); }
From source file:Main.java
public static String getNiceFontName(Font font) { if (font == null) return ""; StringBuilder buf = new StringBuilder(); buf.append(font.getName()); buf.append(", "); switch (font.getStyle()) { case Font.BOLD: buf.append("bold"); break;//from ww w . j a v a 2 s . c o m case Font.ITALIC: buf.append("italic"); break; case Font.PLAIN: buf.append("plain"); break; } buf.append(", "); buf.append(font.getSize()); return buf.toString(); }