本帖最后由 真爱有你 于 2021-9-3 10:36 编辑
/*****************************************************************************************************
*****************************************************************************************************/
import java.util.*;
class JavaMultiClass
{
public static Byte x = 1;
public static Double y = 0.1123581321345589, z = x / y;
public static Integer Unicode = 0x2661;
public static Character Alpha = '$', Beta = '¥';
public static String Alphas = Alpha.toString(), Betas = Beta.toString(), Strings;
public static StringBuffer Biden = new StringBuffer("ABCDEFG");
public static void NumberValue()
{
System.out.println(z.byteValue()); // 将Number对象z的值转换为byte类型
System.out.println(x.doubleValue()); // 将Number对象x的值转换为double类型
System.out.println(x.floatValue()); // 将Number对象x的值转换为float类型
System.out.println(x.intValue()); // 将Number对象x的值转换为int类型
System.out.println(x.longValue()); // 将Number对象x的值转换为long类型
System.out.println(x.shortValue()); // 将Number对象x的值转换为short类型
for(int i=2; i<=36; i++)
{
int First = Integer.parseInt("10", i); // 2~36
int Second = Integer.parseInt("100", i); // 2~36的平方
int Third = Integer.parseInt("1000", i); // 2~36的立方
//System.out.println(Integer.valueOf(Integer.toString((--i), 10))); // 程序进入无限循环
System.out.println(Integer.valueOf(Integer.toString(i - 1, 10)));
System.out.println(First + "、" + Second + "、" + Third);
}
}
public static void CharValue()
{
char[] Characters = {0};
int[] Diagrams = {0x4DC0, 0x4DC1, 0x4DC2, 0x4DC3, 0x4DC4, 0x4DC5, 0x4DC6, 0x4DC7,
0x4DC8, 0x4DC9, 0x4DCA, 0x4DCB, 0x4DCC, 0x4DCD, 0x4DCE, 0x4DCF,
0x4DD0, 0x4DD1, 0x4DD2, 0x4DD3, 0x4DD4, 0x4DD5, 0x4DD6, 0x4DD7,
0x4DD8, 0x4DD9, 0x4DDA, 0x4DDB, 0x4DDC, 0x4DDD, 0x4DDE, 0x4DDF,
0x4DE0, 0x4DE1, 0x4DE2, 0x4DE3, 0x4DE4, 0x4DE5, 0x4DE6, 0x4DE7,
0x4DE8, 0x4DE9, 0x4DEA, 0x4DEB, 0x4DEC, 0x4DED, 0x4DEE, 0x4DEF,
0x4DF0, 0x4DF1, 0x4DF2, 0x4DF3, 0x4DF4, 0x4DF5, 0x4DF6, 0x4DF7,
0x4DF8, 0x4DF9, 0x4DFA, 0x4DFB, 0x4DFC, 0x4DFD, 0x4DFE, 0x4DFF};
for(int i=0; i<=63; i++)
{
System.out.println(Character.toChars(Diagrams[ i ])); // 将字符编码转换为字符
}
Character.toChars(Unicode, Characters, 0);
System.out.println(Characters);
System.out.println(Alpha.equals(Beta));
System.out.println(Alpha.compareTo(Beta));
System.out.println(Character.compare(Beta, Alpha));
System.out.println(Character.isLetter(Alpha));
System.out.println(Character.isDigit(Beta));
System.out.println(Character.isWhitespace(' '));
System.out.println(Character.isUpperCase('A'));
System.out.println(Character.isLowerCase('b'));
System.out.println(Character.toUpperCase('A'));
System.out.println(Character.toLowerCase('b'));
}
public static void StringValue()
{
char[] Values = {'J', 'a', 'v', 'a', '在', '线', '编', '程'};
//System.out.println(Values.length);
Strings = Strings.copyValueOf(Values, 0, (Values.length - 1));
List<String> Symbol = new LinkedList<>();
Symbol.add("阿伏伽德罗常数");
Symbol.add("6.02214179E+23");
Strings.getChars(1,Strings.length(),Values, 2);
//System.out.println(Strings);
System.out.println(Values);
System.out.println(String.join(":", Symbol));
System.out.println(Strings.charAt(0));
System.out.println(Strings.contains("Java"));
System.out.println(Strings.endsWith("Java"));
System.out.println(Strings.equals("Java在线编程"));
System.out.println(Strings.equalsIgnoreCase("JAVA在线编程"));
System.out.println(Strings.hashCode());
System.out.println(Strings.indexOf("Java", 0));
System.out.println(Strings.intern());
System.out.println(Strings.lastIndexOf("Java", Strings.length()));
System.out.println(Strings.matches("[^\\s]+$"));
System.out.println(Alphas.compareTo(Betas));
System.out.println(Alphas.compareToIgnoreCase(Betas));
System.out.println(Alphas.concat(Betas));
System.out.println(Alphas.contentEquals(Biden));
}
public static void FirstOrderCal()
{
Double r = Math.random(), temp = 1 / r;
int i = temp.intValue();
System.out.println(Math.E);
System.out.println(Math.PI);
System.out.println(Math.exp(r));
System.out.println(Math.expm1(r));
System.out.println(Math.log1p(r));
System.out.println(Math.nextDown(r));
System.out.println(Math.nextUp(r));
System.out.println(Math.rint(r));
System.out.println(Math.round(r));
System.out.println(Math.ulp(r));
System.out.println(Math.scalb(r, i));
System.out.println(Math.atan2(r, y));
System.out.println(Math.hypot(r, y));
System.out.println(Math.pow(r, y));
System.out.println(Math.max(r, y));
System.out.println(Math.min(r, y));
}
public static void SecondOrderCal()
{
System.out.println(y + "的正弦等于:" + Math.sin(y));
System.out.println(y + "的余弦等于:" + Math.cos(y));
System.out.println(y + "的正切等于:" + Math.tan(y));
System.out.println(y + "的余切等于:" + 1/(Math.tan(y)));
System.out.println(y + "的反正弦等于:" + Math.asin(y));
System.out.println(y + "的反余弦等于:" + Math.acos(y));
System.out.println(y + "的反正切等于:" + Math.atan(y));
System.out.println(y + "的双曲正弦等于:" + Math.sinh(y));
System.out.println(y + "的双曲余弦等于:" + Math.cosh(y));
System.out.println(y + "的双曲正切等于:" + Math.tanh(y));
System.out.println(y + "转换为角度等于:" + Math.toDegrees(y));
System.out.println(y + "转换为弧度等于:" + Math.toRadians(y));
System.out.println(y + "的绝对值等于:" + Math.abs(y));
System.out.println(y + "的平方根等于:" + Math.sqrt(y));
System.out.println(y + "的立方根等于:" + Math.cbrt(y));
System.out.println(y + "的自然对数等于:" + Math.log(y));
System.out.println(y + "的常用对数等于:" + Math.log10(y));
System.out.println("大于等于" + y + "的最小整数为:" + Math.ceil(y));
System.out.println("小于等于" + y + "的最大整数为:" + Math.floor(y));
}
public static void main (String[] args)
{
NumberValue();
CharValue();
StringValue();
FirstOrderCal();
SecondOrderCal();
}
}
|