List of usage examples for java.lang StringBuilder StringBuilder
@HotSpotIntrinsicCandidate
public StringBuilder()
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)); }/*w ww. j a va 2 s . co m*/ return buffer.toString(); }
From source file:Main.java
private static String bytesToHexString(byte[] bytes) { StringBuilder builder = new StringBuilder(); for (int i = 0; i < bytes.length; i++) { String hex = Integer.toHexString(0xFF & bytes[i]); if (hex.length() == 1) { builder.append("0"); }/*w w w .j av a 2 s . c o m*/ builder.append(hex); } return builder.toString(); }
From source file:Main.java
public static String getUuidStringFromByteArray(byte[] bytes) { StringBuilder buffer = new StringBuilder(); for (int i = 0; i < bytes.length; i++) { buffer.append(String.format("%02x", bytes[i])); }/* w w w.j a v a 2s . com*/ return buffer.toString(); }
From source file:Main.java
public static String bytesToHexString(byte abyte0[]) { StringBuilder stringbuilder = new StringBuilder(); for (int i = 0; i < abyte0.length; i++) { stringbuilder.append(String.format("%02x ", new Object[] { Byte.valueOf(abyte0[i]) })); }// www .j a v a 2 s . c o m return stringbuilder.toString(); }
From source file:Main.java
public static String byte2hexNoUpperCase(byte[] bytes) { StringBuilder sign = new StringBuilder(); for (int i = 0; i < bytes.length; i++) { String hex = Integer.toHexString(bytes[i] & 0xFF); if (hex.length() == 1) { sign.append("0"); }/*from w ww .ja v a 2s . co m*/ sign.append(hex); } return sign.toString(); }
From source file:Main.java
public static String printMap(Map in) { StringBuilder sb = new StringBuilder(); for (Iterator it = in.keySet().iterator(); it.hasNext();) { String key = (String) it.next(); sb.append(key).append(" : ").append(in.get(key)); sb.append("\n"); }//w w w . ja v a 2s. c o m return sb.toString(); }
From source file:Main.java
public static String joinArray(int[] arr, String seperator) { StringBuilder sb = new StringBuilder(); for (Integer i : arr) { sb.append(i).append(seperator);/*from w w w .j av a 2 s . co m*/ } if (sb.length() > 0) { return sb.subSequence(0, sb.length() - seperator.length()).toString(); } return sb.toString(); }
From source file:Main.java
public static String getHexBytes(String header, byte[] bytes) { StringBuilder sb = new StringBuilder(); if (header != null) { sb.append(header + ": "); }/*from ww w.j av a 2 s. c o m*/ for (byte b : bytes) { sb.append(String.format("%02X ", b)); } return sb.toString(); }
From source file:Main.java
public static String implode(String glue, String[] array) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < array.length; i++) { sb.append(array[i]);/* w ww . ja v a2 s . c o m*/ if (i != array.length - 1) { sb.append(glue); } } return sb.toString(); }
From source file:Main.java
public static String bytesToHexWithSpaces(byte[] bytes) { StringBuilder newString = new StringBuilder(); for (byte aByte : bytes) { String byteHex = String.format("%02X", (byte) aByte); newString.append(byteHex).append(" "); }//from w w w. jav a 2 s . c om return newString.toString().trim(); }