/** * @ProjectName:tms-taxes. * @Title: TestSSC.java. * @Package com.deppon.tms.module.accrued.server.action. * @Description: TODO(用一句话描述该文件做什么). * @author 258276. * @date 2016-3-14 下午3:50:15. * @version Copyright (c)2016 V1.0,com.deppon.com All Rights Reserved. * @since JDK 1.6 */ import java.util.Arrays; /** * @ClassName: TestSSC. * @Description: TODO(用一句话描述该类做什么) * @author 258276. * @date: 2016-3-14 下午3:50:15. * @version Copyright (c) 1.0. * */ public class TestSSC { static int []a = new int[4]; public static void main(String[] args) throws Exception { // TODO Auto-generated method stub String s = HttpGet1.getByString(UrlString.urlString); int[] ab = new int[s.length()]; for(int i = 0; i < s.length(); i++) { //先由字符串转换成char,再转换成String,然后Integer ab[i] = Integer.parseInt( String.valueOf(s.charAt(i))); } int []aaa= ab; //int []aaa= {1,1,1,1,1}; int []bbb= new int [3]; int []ccc= new int [3]; int middle=0; int last=0; for(int i=0;i<aaa.length;i++){ bbb[0]=aaa[1]; bbb[1]=aaa[2]; bbb[2]=aaa[3]; ccc[0]=aaa[2]; ccc[1]=aaa[3]; ccc[2]=aaa[4]; } Arrays.sort(bbb); for(int i=0;i<bbb.length;i++){ middle+=bbb[i]; } //中三和值加跨度之后取个位 int gewei1= getValue(middle+bbb[2]-bbb[0]); //定义十位对码 int duima1= 0; if(gewei1>5){ duima1=gewei1-5; }else{ if(gewei1==5){ duima1=0; }else{ duima1=5+gewei1; } } System.out.println("中三和值"+String.valueOf(middle)+"---中三跨度"+String.valueOf(bbb[2]-bbb[0])+"和等于"+String.valueOf(middle+bbb[2]-bbb[0])+" "+"十位杀码"+String.valueOf(duima1)+","+String.valueOf(gewei1)); // System.out.println("十位杀码"+String.valueOf(duima1)+","+String.valueOf(gewei1)); Arrays.sort(ccc); for(int i=0;i<ccc.length;i++){ last+=ccc[i]; } // 后三和值加跨度取个位 int gewei2= getValue(last+ccc[2]-ccc[0]); //定义个位对码 int duima2 = 0; if(gewei2>5){ duima2=gewei2-5; }else{ if(gewei2==5){ duima2=0; }else{ duima2=5+gewei2; } } System.out.println("后三和值"+String.valueOf(last)+"---后三跨度"+String.valueOf(ccc[2]-ccc[0])+"和等于"+String.valueOf(last+ccc[2]-ccc[0])+" "+"个位杀码"+String.valueOf(duima2)+","+String.valueOf(gewei2)); // System.out.println("个位杀码"+String.valueOf(duima2)+","+String.valueOf(gewei2)); //定义传入的数组 十位 int [] into1= new int[8]; ////定义传入的数组个位 int [] into2= new int [8]; int [] into= {0,1,2,3,4,5,6,7,8,9}; int k = 0; int m=0; for(int s1:into){ if(s1!=duima1&&gewei1!=s1){ into1[k] = s1; k++; } } for(int s2:into){ if(s2!=duima2&&gewei2!=s2){ into2[m] = s2; m++; } } /* System.out.print("十位---"); for(int i=0;i<into1.length;i++){ System.out.print(into1[i]+" "); } System.out.println(); System.out.print("个位---"); for(int i=0;i<into2.length;i++){ System.out.print(into2[i]+" "); }*/ System.out.println(); System.out.println(); returnSSC(into1,into2); } public static void timeTaskSSC()throws Exception { String s = HttpGet1.getByString(UrlString.urlString); int[] ab = new int[s.length()]; for(int i = 0; i < s.length(); i++) { //先由字符串转换成char,再转换成String,然后Integer ab[i] = Integer.parseInt( String.valueOf(s.charAt(i))); } int []aaa= ab; //int []aaa= {1,1,1,1,1}; int []bbb= new int [3]; int []ccc= new int [3]; int middle=0; int last=0; for(int i=0;i<aaa.length;i++){ bbb[0]=aaa[1]; bbb[1]=aaa[2]; bbb[2]=aaa[3]; ccc[0]=aaa[2]; ccc[1]=aaa[3]; ccc[2]=aaa[4]; } Arrays.sort(bbb); for(int i=0;i<bbb.length;i++){ middle+=bbb[i]; } //中三和值加跨度之后取个位 int gewei1= getValue(middle+bbb[2]-bbb[0]); //定义十位对码 int duima1= 0; if(gewei1>5){ duima1=gewei1-5; }else{ if(gewei1==5){ duima1=0; }else{ duima1=5+gewei1; } } System.out.println("中三和值"+String.valueOf(middle)+"---中三跨度"+String.valueOf(bbb[2]-bbb[0])+"和等于"+String.valueOf(middle+bbb[2]-bbb[0])+" "+"十位杀码"+String.valueOf(duima1)+","+String.valueOf(gewei1)); // System.out.println("十位杀码"+String.valueOf(duima1)+","+String.valueOf(gewei1)); Arrays.sort(ccc); for(int i=0;i<ccc.length;i++){ last+=ccc[i]; } // 后三和值加跨度取个位 int gewei2= getValue(last+ccc[2]-ccc[0]); //定义个位对码 int duima2 = 0; if(gewei2>5){ duima2=gewei2-5; }else{ if(gewei2==5){ duima2=0; }else{ duima2=5+gewei2; } } System.out.println("后三和值"+String.valueOf(last)+"---后三跨度"+String.valueOf(ccc[2]-ccc[0])+"和等于"+String.valueOf(last+ccc[2]-ccc[0])+" "+"个位杀码"+String.valueOf(duima2)+","+String.valueOf(gewei2)); // System.out.println("个位杀码"+String.valueOf(duima2)+","+String.valueOf(gewei2)); //定义传入的数组 十位 int [] into1= new int[8]; ////定义传入的数组个位 int [] into2= new int [8]; int [] into= {0,1,2,3,4,5,6,7,8,9}; int k = 0; int m=0; for(int s1:into){ if(s1!=duima1&&gewei1!=s1){ into1[k] = s1; k++; } } for(int s2:into){ if(s2!=duima2&&gewei2!=s2){ into2[m] = s2; m++; } } /* System.out.print("十位---"); for(int i=0;i<into1.length;i++){ System.out.print(into1[i]+" "); } System.out.println(); System.out.print("个位---"); for(int i=0;i<into2.length;i++){ System.out.print(into2[i]+" "); }*/ System.out.println(); System.out.println(); returnSSC(into1,into2); } //算个位 public static int getValue(int x){ if(x==0){ return 0; } int x1=x; //先得到x的位数 int i=1,k,count=0;//count为x的位数 for(i=0;i<4;i++)//计算到千位即可 if(x1/Math.pow(10, i)!=0) count++; for(k=0;k<count;k++){//依次求出个位数~千位数 a[k]=x1%10; x1=x1/10; } return a[0]; } //返回64注 public static String returnSSC(int[] sw,int[] gw){ String str=""; for(int i=0;i<sw.length;i++){ for(int j=0;j<gw.length;j++){ str+=String.valueOf(sw[i])+String.valueOf(gw[j])+" "; if(j==7){ str=str+"\n"; } } } System.out.println(str); return str; } }