创建初始化动态数组
public class ArrayTest3 {
public static void main(String[] args) {
start();
}
public static void start() {
String [] poker = new String[54];
花色、数字排列组合
String [] colors = {"♠","♥","♣","♦"};
String [] numbers = {"3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A", "2"};
int index = 0;
for (int i = 0; i < colors.length; i++) {
for (int j = 0; j < numbers.length; j++) {
poker[index] = colors[i] + numbers[j];
index++;
}
}
poker[index++] = "小王";
poker[index] = "大王";
System.out.println("新牌");
for (int i = 0; i < poker.length; i++) {
System.out.print(poker[i] + " ");
}
System.out.println();
洗牌
for (int i = 0; i < poker.length; i++) {
int index1 = (int)(Math.random() * poker.length);
int index2 = (int)(Math.random() * poker.length);
String temp = poker[index2];
poker[index2] = poker[index1];
poker[index1] = temp;
}
System.out.println("洗牌后");
for (int i = 0; i < poker.length; i++) {
System.out.print(poker[i] + " ");
}
}
}
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 使用C#创建一个MCP客户端
· ollama系列1:轻松3步本地部署deepseek,普通电脑可用
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 按钮权限的设计及实现