JAVA获取12个月
package 包名.路径;
import java.time.Month;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class MonthDemo {
public static void main(String[] args) {
Month[] values = Month.values();
List<Integer> collect = Stream.of(values)
.map(Month::getValue)
.collect(Collectors.toList());
for (int e : collect){
System.out.print(" " + e + "月 ");
}
System.out.println();
for (Month e : values){
System.out.print(e + " ");
}
int max = 2147483647;
int binary = 0x7fffffff;
if (Integer.MAX_VALUE == max && max == binary){
System.out.println();
System.out.println("相等");
}
}
}