---------------------- ASP.Net+Unity开发、.Net培训、期待与您交流! ----------------------
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
<br> package temp01; //进制转换 public class TempTest
{ public static void main(String
args[]){ //一个月30天(30进) int d
= 361 ; String
date = changeDay(d); sop(date); } //把总天数根据天数转换为年月
日(以一年365天一个月30天转换) public static String
changeDay( int d){ int y
= d/ 365 ; d
-= 365 *y; int m
= d/ 30 ; d
-= 30 *m; return y+ "Y" +m+ "M" +d+ "D" ; } public static void sop(Object
obj){ System.out.println(obj); } } |
--->两字符字符包含判断:应用于密码设置的限定等:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
package temp01; public class TempTest
{ public static void main(String
args[]){ //判断两个字符串中是否还有相同的字符 String
s1 = "xianyou_Liang" ; String
s2 = "~!@#$%^&*()_+.,<>;:'"/?" ; sop(isContain(s1,
s2)); } public static boolean isContain(String
s1, String s2){ char []
c = s2.toCharArray(); for ( int i= 0 ;i<c.length;i++){ if (s1.contains(String.valueOf(c[i]))) return true ; } return false ; } public static void sop(Object
obj){ System.out.println(obj); } } |
---------------------- ASP.Net+Unity开发、.Net培训、期待与您交流! ----------------------