股票交易时间
生成股票分时图X轴的坐标数据
import java.util.ArrayList;
public class Test {
public static void main(String[] args) {
ArrayList<String> values = new ArrayList<String>();
int hour = 9; // 小时
int minute = 3;
int second = 0;
for (int i = 0; i <= 240; i++) {
if (i > 120 && hour < 12){
hour = 13;
minute = 0;
}
second = (i % 10);
if (i / 10 > 0 && (second == 0)) {
minute++;
}
if (minute > 5) {
minute = 0;
hour++;
}
if (i == 120) {
values.add(hour + ":" + minute + second + "/13:00");
} else {
values.add(hour + ":" + minute + second);
}
}
System.out.println(values);
}
}