Converts a Color to an 7 byte hex string starting with '#'.
(Color c)
| 29 | |
| 30 | /** Converts a Color to an 7 byte hex string starting with '#'. */ |
| 31 | public static String c2hex(Color c) { |
| 32 | int i = c.getRGB(); |
| 33 | char[] buf7 = new char[7]; |
| 34 | buf7[0] = '#'; |
| 35 | for (int pos=6; pos>=1; pos--) { |
| 36 | buf7[pos] = hexDigits[i&0xf]; |
| 37 | i >>>= 4; |
| 38 | } |
| 39 | return new String(buf7); |
| 40 | } |
| 41 | |
| 42 | /** Converts a float to an 9 byte hex string starting with '#'. */ |
| 43 | public static String f2hex(float f) { |
no test coverage detected