📄 test001.java
字号:
/**
*
*/
package com.xiaoran.test;
import java.util.Random;
/**
* @author jkll
*
*/
public class Test001 {
/**
*
*/
public Test001() {
// TODO Auto-generated constructor stub
}
private final static Integer[] RED = {
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, };
private final static Integer[] BLUE = {
1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 16, };
private static Integer RandomInteger(int i) {
Random rd = new Random();
return rd.nextInt(i);
}
private static Integer[] maoPao(Integer[] a) {
int k = 0;
for(int j=0;j<a.length-1;j++) {
for(int i=0;i<a.length-1-j;i++)
if(a[i]>a[i+1]){
k = a[i];
a[i] = a[i+1];
a[i+1] = k;
}
}
return a;
}
public static void redAndBlue() {
Integer[] redBall = new Integer[6];
Integer blueBall = 0;
for(int i=0;i<6;i++)
redBall[i] = RED[Test001.RandomInteger(33)];
Test001.maoPao(redBall);
blueBall = BLUE[Test001.RandomInteger(16)];
String[] tt = Test001.format(redBall, blueBall);
String tmp = "";
for(int i=0;i<tt.length;i++){
tmp += tt[i]+" ";
}
System.out.println(tmp.substring(0, tmp.length()-1));
}
private static String[] format(Integer[] redBall,Integer blueBall){
String[] tmp = new String[7];
for(int i=0;i<redBall.length;i++){
tmp[i] = redBall[i]<10?"0"+redBall[i]:String.valueOf(redBall[i]);
}
tmp[6] = blueBall<10?"0"+blueBall:String.valueOf(blueBall);
return tmp;
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
for(int i=0;i<16;i++){
if(i%3==1)
Test001.redAndBlue();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -