Java Random Color getRandomColor()

Here you can find the source of getRandomColor()

Description

get Random Color

License

LGPL

Declaration

public static String getRandomColor() 

Method Source Code


//package com.java2s;
//License from project: LGPL 

import java.util.Random;

public class Main {
    public static String getRandomColor() {
        Random ra = new Random();
        int r, g, b;
        r = ra.nextInt(255);/*from w  ww .  java  2s .  c  om*/
        g = ra.nextInt(255);
        b = ra.nextInt(255);
        String hex = String.format("#%02x%02x%02x", r, g, b);
        return hex;
    }
}

Related

  1. getRandom()
  2. getRandomColor()
  3. getRandomColor()
  4. getRandomColor()
  5. GetRandomColor()
  6. getRandomColor()
  7. getRandomColor()
  8. getRandomColor()
  9. getRandomColor()