List of usage examples for java.lang StringBuilder StringBuilder
public StringBuilder(CharSequence seq)
From source file:Main.java
public static String constructIdList(long[] idList) { StringBuilder strBuild = new StringBuilder(""); strBuild.append("["); for (int i = 0; i < idList.length; i++) { if (i != idList.length - 1) { strBuild.append(idList[i]);//from w w w . ja va 2 s .c o m strBuild.append(","); } else { strBuild.append(idList[i]); } } strBuild.append("]"); // idlist end return strBuild.toString(); }
From source file:Main.java
public static String byteArrayToHexString(byte[] value) { StringBuilder stringBuilder = new StringBuilder(""); for (int i = 0; i < value.length; i++) { int v = value[i] & 0xFF; String hv = Integer.toHexString(v); if (hv.length() < 2) { stringBuilder.append(0);/*from ww w.ja va2 s. c o m*/ } stringBuilder.append(hv); } return stringBuilder.toString(); }
From source file:Main.java
public static String bytesToHexString(byte[] src) { StringBuilder stringBuilder = new StringBuilder(""); if (src == null || src.length <= 0) { return null; }//from w w w .j av a 2s . c o m for (int i = 0; i < src.length; i++) { int v = src[i] & 0xFF; String hv = Integer.toHexString(v); if (hv.length() < 2) { stringBuilder.append(0); } stringBuilder.append(hv + " "); } return stringBuilder.toString(); }
From source file:Main.java
public static String prettyShortParams(Class... params) { StringBuilder signature = new StringBuilder("("); for (int i = 0; i < params.length; i++) { signature.append(humanShort(params[i])); if (i < params.length - 1) signature.append(','); }/* ww w .jav a2s. c o m*/ signature.append(")"); return signature.toString(); }
From source file:Main.java
public static String bytesToHexString(byte[] src) { StringBuilder stringBuilder = new StringBuilder(""); if (src == null || src.length <= 0) { return null; }//from w w w. j a v a2s .c o m for (int i = 0; i < src.length; i++) { int v = src[i] & 0xFF; String hv = Integer.toHexString(v); if (hv.length() < 2) { stringBuilder.append(0); } stringBuilder.append(hv); } return stringBuilder.toString(); }
From source file:Main.java
public static String dumpThreads() { StringBuilder sb = new StringBuilder("\n"); ThreadGroup tg, parent = Thread.currentThread().getThreadGroup(); while ((tg = parent.getParent()) != null) { parent = tg;// w ww . j ava 2 s. co m } int size = 2 * parent.activeGroupCount(); ThreadGroup[] list = new ThreadGroup[size]; int actual = parent.enumerate(list, true); //System.out.print("found " + list); sb.append("tgs: " + actual + "\n"); if (list != null && list.length > 0) { for (ThreadGroup g : list) { if (g == null) { continue; } sb.append(" " + g.getName() + ": " + g.activeCount() + "\n"); Thread[] threads = new Thread[g.activeCount()]; g.enumerate(threads, false); for (Thread t : threads) { if (t != null) { sb.append(" " + t.getName() + "\n"); } } } } else { System.out.println("empty thread group list"); } return sb.toString() + "\n"; }
From source file:Main.java
public static String bytesToHexString(byte[] src) { StringBuilder stringBuilder = new StringBuilder(""); if (src == null || src.length <= 0) { return null; }//from w ww. j av a 2 s. c o m for (int i = 0; i < src.length; i++) { int v = src[i] & 0xFF; String hv = Integer.toHexString(v); if (hv.length() < 2) { stringBuilder.append(0); } stringBuilder.append(hv); } return stringBuilder.toString().toUpperCase(); }
From source file:Main.java
public static String getUserAgent(Context context) { StringBuilder sb = new StringBuilder("MAC_XM"); return sb.toString(); }
From source file:Main.java
public static String getEncodingLibraryPath(Context paramContext) { return new StringBuilder(String.valueOf(paramContext.getApplicationInfo().nativeLibraryDir)) .append("/libencoding.so").toString(); }
From source file:Main.java
public static String hexEncode(byte[] in) { StringBuilder builder = new StringBuilder(in.length * 2); Formatter formatter = new Formatter(builder); for (byte inByte : in) { formatter.format("%02x", inByte); }//www .j a va 2s . c o m return builder.toString(); }