List of usage examples for java.lang String String
public String(StringBuilder builder)
From source file:Main.java
public static String md5Hex(String input) { return new String(Hex.encodeHex(DigestUtils.md5(input))); }
From source file:Main.java
public static String getString(byte[] dest, byte[] bytes, int srcPos, int length) { System.arraycopy(bytes, srcPos, dest, 0, length); return new String(dest); }
From source file:Main.java
public static String decode(String s) { if (s == null) return null; try {//from w ww . ja va 2 s . c o m return new String(Base64.decode(s, Base64.DEFAULT)); } catch (Exception e) { return null; } }
From source file:Main.java
public static String right(String s, int chars) { String t = s;//from w ww .j av a2s . c o m if (null == t) t = ""; String retval = new String(t); int len = retval.length(); if (len > chars) { try { retval = retval.substring(len - chars, len); } catch (Exception e) { // shouldn't ever happen ... but return original string in case } } return retval; }
From source file:Main.java
public static String repeatChar(char ch, int num) { char c[] = new char[num]; for (int i = 0; i < num; i++) c[i] = ch;/* w w w. j a v a2 s . co m*/ return new String(c); }
From source file:Main.java
private static String bytes2String(final byte[] bytes) { if (bytes == null) return null; return new String(bytes); }
From source file:Main.java
public static String decodeToString(String encodedString) { try {/* www. j a v a 2 s .c o m*/ return new String(Base64.decode(encodedString, Base64.NO_WRAP)); } catch (Exception e) { e.printStackTrace(); } return ""; }
From source file:Main.java
private static String getMethodName(String fildeName) { byte[] items = fildeName.getBytes(); items[0] = (byte) ((char) items[0] - 'a' + 'A'); return new String(items); }
From source file:Main.java
public static String byteToStringOfBit(byte[] bs) { BinaryCodec binaryCodec = new BinaryCodec(); return new String(binaryCodec.encode(bs)); }
From source file:Main.java
public static String decrypt(String key, String value) { String result = null;// w ww . j a v a2s . c om //result = value result = new String(decodeBase64(value)); result = (key != null && result.startsWith(key) ? result.substring(key.length()) : result); return result; }