ColorUtils { public static int toARGB(int a, int r, int g, int b) { return ((a & 0xff) << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff); }  static int toARGB(int a, int r, int g, int b); static int getRed(int argb); static int getGreen(int argb); static int getBlue(int argb); static int getAlpha(int argb);  }
@Test public void toARGB() { int a = 255; int r = 200; int g = 150; int b = 50; int argb = ColorUtils.toARGB(a, r, g, b); assertEquals(a, ColorUtils.getAlpha(argb)); assertEquals(r, ColorUtils.getRed(argb)); assertEquals(g, ColorUtils.getGreen(argb)); assertEquals(b, ColorUtils.getBlue(argb)); }