编程语言
首页 > 编程语言> > JAVA基础

JAVA基础

作者:互联网

//TreeSet
        TreeSet<Integer> set = new TreeSet<>();
        int n = in.nextInt();
        for(int i=0; i<n; i++){
            set.add(in.nextInt());
        }
        for(Integer a : set){
            System.out.println(a);
        }
/*
https://blog.csdn.net/Cricket_7/article/details/94430056
倒序
*/


//大数
    String a = in.next();
        String b = in.next();
        BigInteger m = new BigInteger(a);
        BigInteger n = new BigInteger(b);
        m = m.add(n);
        System.out.println(m.toString());
//String转char
 char[] a = s.toCharArray();
//char转String
s2[i] = String.valueOf(a);
String q2 = new String(a);

//String转int
tp1 = Integer.parseInt(a);

//保留小数输出格式
double ans
System.out.println(String.format("%.3f",ans));

//split
for(String a:x.split("/"))

 

标签:BigInteger,JAVA,String,int,基础,char,new,TreeSet
来源: https://www.cnblogs.com/h404nofound/p/16588173.html