java - How to store hex colors in an array -


how store hex colors in following table in private array?

name    r   g   b black   00  00  00 navy    00  00  80 blue    00  00  ff 

the names of colors stored in public enum. array should class attribute.

public enum color_names {     black, navy, blue } 

you can use enum store values you:

public enum colors {     black(0x00, 0x00, 0x00),     navy(0x00, 0x00, 0x80),     blue(0x00, 0x00, 0xff);      private int red;     private int green;     private int blue;      private colors(int red, int green, int blue) {         this.red = red;         this.green = green;         this.blue = blue;     }      public int getred() {         return this.red;     }      public int getgreen() {         return this.green;     }      public int getblue() {         return this.blue;     } } 

Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -