List of usage examples for java.lang String String
public String()
From source file:Main.java
private static int gbValue(char ch) { String str = new String(); str += ch;//from w w w . ja v a 2 s . c o m try { byte[] bytes = str.getBytes("GBK"); if (bytes.length < 2) return 0; return (bytes[0] << 8 & 0xff00) + (bytes[1] & 0xff); } catch (Exception e) { return 0; } }
From source file:Main.java
private static String pickGradient(int length) { String[] colors = { "ffcc00", "ff9900", "ff6600", "ff3300", "fd0000" }; String out = new String(); if (length >= 1) out += colors[0];/* w ww .jav a 2 s. c om*/ for (int i = 1; i < length; i++) { out += "," + colors[i]; } return out; }