List of usage examples for java.lang String String
public String(StringBuilder builder)
From source file:Main.java
private static byte uniteBytes(byte src0, byte src1) { byte _b0 = Byte.decode(new String(new byte[] { src0 })).byteValue(); _b0 = (byte) (_b0 << 4); byte _b1 = Byte.decode(new String(new byte[] { src1 })).byteValue(); byte ret = (byte) (_b0 | _b1); byte aret = Byte.decode("0x" + ret).byteValue(); return aret;//from w ww. jav a2s . co m }
From source file:Main.java
public static String encodeBASE64(String s) { if (s == null) return null; return new String(Base64.encode(s.getBytes(), Base64.DEFAULT)); }
From source file:Main.java
public static String MakeX10String(String nodeString) { String x10String = new String(nodeString); x10String.trim();/* w w w . j av a2 s . c o m*/ System.err.println(x10String.startsWith("\'")); //nodeString.c String temp = "\'"; if (x10String.startsWith("\'") && x10String.endsWith("\'")) { x10String = x10String.substring(1, x10String.length() - 1); } x10String = x10String.replace("\"", "\\\""); x10String = x10String.replace("\'\'", "\\\'"); x10String = "\"" + x10String + "\""; return x10String; }
From source file:Main.java
public static String _getReadableByteArr(byte[] input) { String out = new String(input); if (!_isItReadable(out)) out = _byteArrayToB64(input);//from ww w. j a v a2 s . c o m else out = _byteArrayToReadableStr(input); return out; }
From source file:Main.java
public static String hideUsernameString(String username) { String clone = new String(username); char us[] = username.toCharArray(); if (username.length() > 5) { for (int i = 2; i < username.length() - 2; i++) { us[i] = '*'; clone = new String(us); }/*from www. j a v a 2 s . co m*/ } else { for (int i = 1; i < username.length(); i++) { us[i] = '*'; clone = new String(us); } } return clone; }
From source file:Main.java
private static String alphabetize(String s) { char[] a = s.toCharArray(); Arrays.sort(a);// w w w . j a va 2s . com return new String(a); }
From source file:Main.java
public final static int getLength(String text) { int length = 0; for (int i = 0; i < text.length(); i++) { if (new String(text.charAt(i) + "").getBytes().length > 1) { length += 2;/*from ww w .ja v a 2 s . com*/ } else { length += 1; } } return length / 2; }
From source file:Main.java
public static String decode(String str, int time) { System.out.println(str);/*from w w w. j ava 2 s .c o m*/ String result = new String(str); for (int i = 0; i < time; i++) { System.out.println("i : " + i); byte[] decode = Base64.decode(result.getBytes(), Base64.NO_WRAP); result = new String(decode); } return result; }
From source file:Main.java
public static String getFromBASE64(String s) { byte[] result = Base64.decode(s, Base64.DEFAULT); return new String(result); }
From source file:Main.java
public static String getFromBase64(String strBase64) { byte[] b64 = strBase64.getBytes(); String result = new String(Base64.decode(b64, Base64.DEFAULT)); return result; }