Java Random Color getRandomIntColor()

Here you can find the source of getRandomIntColor()

Description

get Random Int Color

License

Open Source License

Declaration

private static int getRandomIntColor() 

Method Source Code

//package com.java2s;

import java.util.Random;

public class Main {
    private static Random random = new Random();

    private static int getRandomIntColor() {
        int[] rgb = getRandomRgb();
        int color = 0;
        for (int c : rgb) {
            color = color << 8;/* ww  w  .j a  va  2  s  .  c o  m*/
            color = color | c;
        }
        return color;
    }

    private static int[] getRandomRgb() {
        int[] rgb = new int[3];
        for (int i = 0; i < 3; i++) {
            rgb[i] = random.nextInt(255);
        }
        return rgb;
    }
}

Related

  1. getRandomColor(int saturationRandom, float luminance)
  2. getRandomColorInString()
  3. getRandomColour()
  4. getRandomHexColor()
  5. getRandomHexColor()
  6. getRandomRgb()
  7. makeRandomColor()
  8. makeRandomColor()
  9. makeRandomColor(Color color)