File tree Expand file tree Collapse file tree
src/main/java/com/github/hcsp/datatype Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,50 +4,48 @@ public class Cast {
44 // Cast an int to byte
55 // 将int类型转换成byte
66 public static byte int2byte (int i ) {
7- return ( byte ) i ;
7+ return i ;
88 }
99
1010 // Cast an int to short
1111 // 将int类型转换成short
1212 public static short int2short (int i ) {
13- return ( short ) i ;
13+ return i ;
1414 }
1515
1616 // Cast an int to char
1717 // 将int类型转换成char
1818 public static char int2char (int i ) {
19- return ( char ) i ;
19+ return i ;
2020 }
2121
2222 // Cast an int to String, e.g. 123 -> "123"
2323 // 将一个整数转换为字符串,例如,将123转换成字符串"123"
2424 public static String int2String (int i ) {
25- return String . valueOf ( i ) ;
25+ return i ;
2626 }
2727
2828 // Cast an String to int, e.g. "123" -> 123
2929 // 将一个字符串转换成整数,例如,将字符串"123"转换成整数123
3030 public static int string2int (String s ) {
31- return Integer . parseInt ( s ) ;
31+ return s ;
3232 }
3333
3434 // Cast an String to double, e.g. "1.23" -> 1.23
3535 // 将一个字符串转换成double类型,例如,将字符串"1.23"转换成1.23
3636 public static double string2double (String s ) {
37- return Double . parseDouble ( s ) ;
37+ return s ;
3838 }
3939
4040 // Cast an Long to int
4141 // 将Long类型转换成int
4242 public static int Long2int (Long l ) {
43- long z = l ;
44- return (int ) z ;
43+ return l ;
4544 }
4645
4746 // Cast an Double to long
4847 // 将Double类型转换成long
4948 public static long double2Long (Double d ) {
50- double m = d ;
51- return (long ) m ;
49+ return d ;
5250 }
5351}
You can’t perform that action at this time.
0 commit comments