List of usage examples for java.lang StringBuffer StringBuffer
public StringBuffer(CharSequence seq)
From source file:Main.java
public static String getColorText(String text, String colorValue) { StringBuffer sb = new StringBuffer("<font color=\"#"); return sb.append(colorValue).append("\">").append(text).append("</font>").toString(); }
From source file:Main.java
private static String toStringByArray(Object[] value) { StringBuffer sb = new StringBuffer(100); String type = value[0].getClass().getName(); sb.append("{").append(type).append("@"); for (int i = 0; i < value.length; i++) { sb.append(esc(value[i].toString())).append(","); }//w w w . j ava 2 s. co m return sb.substring(0, sb.length() - 1) + "}"; }
From source file:Main.java
public static final String toHexString(byte[] bytes) { StringBuffer buffer = new StringBuffer(bytes.length * 2); for (int i = 0; i < bytes.length; i++) { if (((int) bytes[i] & 0xff) < 0x10) buffer.append("0"); buffer.append(Long.toString((int) bytes[i] & 0xff, 16)); }/*from w w w. j a v a2 s.co m*/ return buffer.toString(); }
From source file:Main.java
public static final String bytesToHexString(byte[] bArray) { StringBuffer sb = new StringBuffer(bArray.length); String sTemp;//from w w w.j ava 2s . c o m for (int i = 0; i < bArray.length; i++) { sTemp = Integer.toHexString((int) (0xFF & bArray[i])); if (sTemp.length() < 2) sb.append(0); sb.append(sTemp.toUpperCase()); sb.append(" "); } return sb.toString(); }
From source file:Main.java
public static String bytesToHexString(byte[] bArray, int count) { StringBuffer sb = new StringBuffer(bArray.length); String sTemp;//from w w w .ja v a2s . c om for (int i = 0; i < count; i++) { sTemp = Integer.toHexString(0xFF & bArray[i]); if (sTemp.length() < 2) sb.append(0); sb.append(sTemp.toUpperCase()); } return sb.toString(); }
From source file:Main.java
public static String reverse(String str) { return new StringBuffer(str).reverse().toString(); }
From source file:Main.java
public static String addInCDataValue(String xmlString) { return new StringBuffer("<![CDATA[").append(xmlString).append("]]>").toString(); }
From source file:Main.java
public static String toString(int X[][]) { StringBuffer res = new StringBuffer("{"); for (int row[] : X) { if (row != X[0]) { res.append(", "); }// ww w . j a va 2 s .c o m res.append(Arrays.toString(row)); } res.append("}"); return res.toString(); }
From source file:Main.java
public static String createXmlResponse(String status, String desription) { StringBuffer response = new StringBuffer( "<?xml version=\"1.0\" encoding=\"UTF-8\"?><response><responseCode>"); response.append(status).append("</responseCode><responseInfo>").append(desription) .append("</responseInfo></response>"); return response.toString(); }
From source file:Main.java
public static String getSringBeforeChar(String sourceStr, char ch) { StringBuffer sb = new StringBuffer(sourceStr); StringBuffer newSb = new StringBuffer(); for (int i = 0; i < sb.length(); i++) { if (sb.charAt(i) == ch) { break; }//from w w w. j ava 2 s . c om newSb.append(sb.charAt(i)); } return newSb.toString(); }