code: public static String colorToString(int col) {
      final char[] buf = new char[] { '#', 'X', 'X', 'X', 'X', 'X', 'X' };
      for(int i = 6; i > 0; i--) {
        final int v = (col & 0xF);
        buf[i] = (char) ((v < 10) ? ('0' + v) : ('a' + v - 10));
        col >>>= 4;
      }
      return new String(buf);
    }
docs: Convert a color name from an integer RGB color to CSS syntax
  
  Note: currently only RGB (from ARGB order) are supported. The alpha channel
  will be ignored.
  
  @param col Color value
  @return Color string