爪哇国新游记之二十一----快算24
四张牌,通过四则运算得到24,一个数限用一次,快者为胜。
代码:
import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set;/*** 快算24* @author heyang**/ public class Caculator{private double anticipate;// 预期结果private double op1;// 操作数一private double op2;// 操作数二private List<String> fomulaList;// 两个操作数进行四则运算能得到预期结果的算式列表// 仅算24的构造函数public Caculator(double[] arr){this(24,arr);}// 完全构造函数,可以指定结果public Caculator(double anticipate,double[] arr){// 2if(arr.length==2){this.anticipate=anticipate;op1=arr[0];op2=arr[1];fomulaList=getFomulaList();}if(arr.length==3){this.anticipate=anticipate;// Cdouble[] arrNew;// Adouble anticipateNew;// arr[2]=BList<String> list;Caculator c;fomulaList=new ArrayList<String>();/// 0,1,2// A+B=C arrNew=new double[2];arrNew[0]=arr[0];arrNew[1]=arr[1];anticipateNew=anticipate-arr[2];c=new Caculator(anticipateNew,arrNew);list=c.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add("("+str+")+"+arr[2]);}}// A-B=CarrNew=new double[2];arrNew[0]=arr[0];arrNew[1]=arr[1];anticipateNew=anticipate+arr[2];c=new Caculator(anticipateNew,arrNew);list=c.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add("("+str+")-"+arr[2]);}}// B-A=CarrNew=new double[2];arrNew[0]=arr[0];arrNew[1]=arr[1];anticipateNew=arr[2]-anticipate;c=new Caculator(anticipateNew,arrNew);list=c.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add(arr[2]+"-("+str+")");}}// A*B=CarrNew=new double[2];arrNew[0]=arr[0];arrNew[1]=arr[1];anticipateNew=anticipate/arr[2];c=new Caculator(anticipateNew,arrNew);list=c.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add("("+str+")*"+arr[2]);}}// A/B=CarrNew=new double[2];arrNew[0]=arr[0];arrNew[1]=arr[1];anticipateNew=anticipate*arr[2];c=new Caculator(anticipateNew,arrNew);list=c.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add("("+str+")/"+arr[2]);}}// B/A=CarrNew=new double[2];arrNew[0]=arr[0];arrNew[1]=arr[1];anticipateNew=arr[2]/anticipate;c=new Caculator(anticipateNew,arrNew);list=c.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add(arr[2]+"/("+str+")");}}/// 1,2,0// A+B=C arrNew=new double[2];arrNew[0]=arr[1];arrNew[1]=arr[2];anticipateNew=anticipate-arr[0];c=new Caculator(anticipateNew,arrNew);list=c.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add("("+str+")+"+arr[0]);}}// A-B=CarrNew=new double[2];arrNew[0]=arr[1];arrNew[1]=arr[2];anticipateNew=anticipate+arr[0];c=new Caculator(anticipateNew,arrNew);list=c.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add("("+str+")-"+arr[0]);}}// B-A=CarrNew=new double[2];arrNew[0]=arr[1];arrNew[1]=arr[2];anticipateNew=arr[0]-anticipate;c=new Caculator(anticipateNew,arrNew);list=c.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add(arr[0]+"-("+str+")");}}// A*B=CarrNew=new double[2];arrNew[0]=arr[1];arrNew[1]=arr[2];anticipateNew=anticipate/arr[0];c=new Caculator(anticipateNew,arrNew);list=c.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add("("+str+")*"+arr[0]);}}// A/B=CarrNew=new double[2];arrNew[0]=arr[1];arrNew[1]=arr[2];anticipateNew=anticipate*arr[0];c=new Caculator(anticipateNew,arrNew);list=c.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add("("+str+")/"+arr[0]);}}// B/A=CarrNew=new double[2];arrNew[0]=arr[1];arrNew[1]=arr[2];anticipateNew=arr[0]/anticipate;c=new Caculator(anticipateNew,arrNew);list=c.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add(arr[0]+"/("+str+")");}}/// 0,2,1// A+B=C arrNew=new double[2];arrNew[0]=arr[0];arrNew[1]=arr[2];anticipateNew=anticipate-arr[1];c=new Caculator(anticipateNew,arrNew);list=c.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add("("+str+")+"+arr[1]);}}// A-B=CarrNew=new double[2];arrNew[0]=arr[0];arrNew[1]=arr[2];anticipateNew=anticipate+arr[1];c=new Caculator(anticipateNew,arrNew);list=c.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add("("+str+")-"+arr[1]);}}// B-A=CarrNew=new double[2];arrNew[0]=arr[0];arrNew[1]=arr[2];anticipateNew=arr[1]-anticipate;c=new Caculator(anticipateNew,arrNew);list=c.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add(arr[1]+"-("+str+")");}}// A*B=CarrNew=new double[2];arrNew[0]=arr[0];arrNew[1]=arr[2];anticipateNew=anticipate/arr[1];c=new Caculator(anticipateNew,arrNew);list=c.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add("("+str+")*"+arr[1]);}}// A/B=CarrNew=new double[2];arrNew[0]=arr[0];arrNew[1]=arr[2];anticipateNew=anticipate*arr[1];c=new Caculator(anticipateNew,arrNew);list=c.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add("("+str+")/"+arr[1]);}}// B/A=CarrNew=new double[2];arrNew[0]=arr[0];arrNew[1]=arr[2];anticipateNew=arr[1]/anticipate;c=new Caculator(anticipateNew,arrNew);list=c.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add(arr[1]+"/("+str+")");}}}if(arr.length==4){this.anticipate=anticipate;// Cdouble[] arrNew;// Adouble anticipateNew;// arr[2]=BList<String> list;Caculator cac;fomulaList=new ArrayList<String>();/// 0,1,2 &3// A+B=C arrNew=new double[3];arrNew[0]=arr[0];arrNew[1]=arr[1];arrNew[2]=arr[2];anticipateNew=anticipate-arr[3];cac=new Caculator(anticipateNew,arrNew);list=cac.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add("("+str+")+"+arr[3]);}}// A-B=CarrNew=new double[3];arrNew[0]=arr[0];arrNew[1]=arr[1];arrNew[2]=arr[2];anticipateNew=anticipate+arr[3];cac=new Caculator(anticipateNew,arrNew);list=cac.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add("("+str+")-"+arr[3]);}}// B-A=CarrNew=new double[3];arrNew[0]=arr[0];arrNew[1]=arr[1];arrNew[2]=arr[2];anticipateNew=arr[3]-anticipate;cac=new Caculator(anticipateNew,arrNew);list=cac.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add(arr[3]+"-("+str+")");}}// A*B=CarrNew=new double[3];arrNew[0]=arr[0];arrNew[1]=arr[1];arrNew[2]=arr[2];anticipateNew=anticipate/arr[3];cac=new Caculator(anticipateNew,arrNew);list=cac.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add("("+str+")*"+arr[3]);}}// A/B=CarrNew=new double[3];arrNew[0]=arr[0];arrNew[1]=arr[1];arrNew[2]=arr[2];anticipateNew=anticipate*arr[3];cac=new Caculator(anticipateNew,arrNew);list=cac.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add("("+str+")/"+arr[3]);}}// B/A=CarrNew=new double[3];arrNew[0]=arr[0];arrNew[1]=arr[1];arrNew[2]=arr[2];anticipateNew=arr[3]/anticipate;cac=new Caculator(anticipateNew,arrNew);list=cac.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add(arr[3]+"/("+str+")");}}/// 0,1,3 & 2// A+B=C arrNew=new double[3];arrNew[0]=arr[0];arrNew[1]=arr[1];arrNew[2]=arr[3];anticipateNew=anticipate-arr[2];cac=new Caculator(anticipateNew,arrNew);list=cac.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add("("+str+")+"+arr[2]);}}// A-B=CarrNew=new double[3];arrNew[0]=arr[0];arrNew[1]=arr[1];arrNew[2]=arr[3];anticipateNew=anticipate+arr[2];cac=new Caculator(anticipateNew,arrNew);list=cac.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add("("+str+")-"+arr[2]);}}// B-A=CarrNew=new double[3];arrNew[0]=arr[0];arrNew[1]=arr[1];arrNew[2]=arr[3];anticipateNew=arr[2]-anticipate;cac=new Caculator(anticipateNew,arrNew);list=cac.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add(arr[2]+"-("+str+")");}}// A*B=CarrNew=new double[3];arrNew[0]=arr[0];arrNew[1]=arr[1];arrNew[2]=arr[3];anticipateNew=anticipate/arr[2];cac=new Caculator(anticipateNew,arrNew);list=cac.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add("("+str+")*"+arr[2]);}}// A/B=CarrNew=new double[3];arrNew[0]=arr[0];arrNew[1]=arr[1];arrNew[2]=arr[3];anticipateNew=anticipate*arr[2];cac=new Caculator(anticipateNew,arrNew);list=cac.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add("("+str+")/"+arr[2]);}}// B/A=CarrNew=new double[3];arrNew[0]=arr[0];arrNew[1]=arr[1];arrNew[2]=arr[3];anticipateNew=arr[2]/anticipate;cac=new Caculator(anticipateNew,arrNew);list=cac.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add(arr[2]+"/("+str+")");}}/// 0,3,2&1// A+B=C arrNew=new double[3];arrNew[0]=arr[0];arrNew[1]=arr[3];arrNew[2]=arr[2];anticipateNew=anticipate-arr[1];cac=new Caculator(anticipateNew,arrNew);list=cac.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add("("+str+")+"+arr[1]);}}// A-B=CarrNew=new double[3];arrNew[0]=arr[0];arrNew[1]=arr[3];arrNew[2]=arr[2];anticipateNew=anticipate+arr[1];cac=new Caculator(anticipateNew,arrNew);list=cac.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add("("+str+")-"+arr[1]);}}// B-A=CarrNew=new double[3];arrNew[0]=arr[0];arrNew[1]=arr[3];arrNew[2]=arr[2];anticipateNew=arr[1]-anticipate;cac=new Caculator(anticipateNew,arrNew);list=cac.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add(arr[1]+"-("+str+")");}}// A*B=CarrNew=new double[3];arrNew[0]=arr[0];arrNew[1]=arr[3];arrNew[2]=arr[2];anticipateNew=anticipate/arr[1];cac=new Caculator(anticipateNew,arrNew);list=cac.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add("("+str+")*"+arr[1]);}}// A/B=CarrNew=new double[3];arrNew[0]=arr[0];arrNew[1]=arr[3];arrNew[2]=arr[2];anticipateNew=anticipate*arr[1];cac=new Caculator(anticipateNew,arrNew);list=cac.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add("("+str+")/"+arr[1]);}}// B/A=CarrNew=new double[3];arrNew[0]=arr[0];arrNew[1]=arr[3];arrNew[2]=arr[2];anticipateNew=arr[1]/anticipate;cac=new Caculator(anticipateNew,arrNew);list=cac.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add(arr[1]+"/("+str+")");}}/// 1,2,3&0// A+B=C arrNew=new double[3];arrNew[0]=arr[1];arrNew[1]=arr[2];arrNew[2]=arr[3];anticipateNew=anticipate-arr[0];cac=new Caculator(anticipateNew,arrNew);list=cac.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add("("+str+")+"+arr[0]);}}// A-B=CarrNew=new double[3];arrNew[0]=arr[1];arrNew[1]=arr[2];arrNew[2]=arr[3];anticipateNew=anticipate+arr[0];cac=new Caculator(anticipateNew,arrNew);list=cac.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add("("+str+")-"+arr[0]);}}// B-A=CarrNew=new double[3];arrNew[0]=arr[1];arrNew[1]=arr[2];arrNew[2]=arr[3];anticipateNew=arr[0]-anticipate;cac=new Caculator(anticipateNew,arrNew);list=cac.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add(arr[0]+"-("+str+")");}}// A*B=CarrNew=new double[3];arrNew[0]=arr[1];arrNew[1]=arr[2];arrNew[2]=arr[3];anticipateNew=anticipate/arr[0];cac=new Caculator(anticipateNew,arrNew);list=cac.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add("("+str+")*"+arr[0]);}}// A/B=CarrNew=new double[3];arrNew[0]=arr[1];arrNew[1]=arr[2];arrNew[2]=arr[3];anticipateNew=anticipate*arr[0];cac=new Caculator(anticipateNew,arrNew);list=cac.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add("("+str+")/"+arr[0]);}}// B/A=CarrNew=new double[3];arrNew[0]=arr[1];arrNew[1]=arr[2];arrNew[2]=arr[3];anticipateNew=arr[0]/anticipate;cac=new Caculator(anticipateNew,arrNew);list=cac.fomulaList;if(list.size()>0){for(String str:list){fomulaList.add(arr[0]+"/("+str+")");}}// 两个两组的if(isEqual(arr[0]*arr[1]+arr[2]*arr[3],anticipate)){fomulaList.add(arr[0]+"*"+arr[1]+"+"+arr[2]+"*"+arr[3]);}if(isEqual(arr[0]*arr[1]-arr[2]*arr[3],anticipate)){fomulaList.add(arr[0]+"*"+arr[1]+"-"+arr[2]+"*"+arr[3]);}if(isEqual(arr[2]*arr[3]-arr[0]*arr[1],anticipate)){fomulaList.add(arr[2]+"*"+arr[3]+"-"+arr[0]+"*"+arr[1]);}if(isEqual(arr[0]/arr[1]+arr[2]/arr[3],anticipate)){fomulaList.add(arr[0]+"/"+arr[1]+"+"+arr[2]+"/"+arr[3]);}if(isEqual(arr[0]/arr[1]-arr[2]/arr[3],anticipate)){fomulaList.add(arr[0]+"/"+arr[1]+"-"+arr[2]+"/"+arr[3]);}if(isEqual(arr[2]/arr[3]-arr[0]/arr[1],anticipate)){fomulaList.add(arr[2]+"/"+arr[3]+"-"+arr[0]+"/"+arr[1]);}if(isEqual(arr[0]/arr[2]+arr[1]/arr[3],anticipate)){fomulaList.add(arr[0]+"/"+arr[2]+"+"+arr[1]+"/"+arr[3]);}if(isEqual(arr[0]/arr[2]-arr[1]/arr[3],anticipate)){fomulaList.add(arr[0]+"/"+arr[2]+"-"+arr[1]+"/"+arr[3]);}if(isEqual(arr[1]/arr[3]-arr[0]/arr[2],anticipate)){fomulaList.add(arr[1]+"/"+arr[3]+"-"+arr[0]+"/"+arr[2]);}if(isEqual(arr[0]/arr[3]+arr[1]/arr[2],anticipate)){fomulaList.add(arr[0]+"/"+arr[3]+"+"+arr[1]+"/"+arr[2]);}if(isEqual(arr[0]/arr[3]-arr[1]/arr[2],anticipate)){fomulaList.add(arr[0]+"/"+arr[3]+"-"+arr[1]+"/"+arr[2]);}if(isEqual(arr[1]/arr[2]-arr[0]/arr[3],anticipate)){fomulaList.add(arr[1]+"/"+arr[2]+"-"+arr[0]+"/"+arr[3]);}}}public void printFomula(){if(fomulaList!=null && fomulaList.size()>0){Set<String> set=new HashSet<String>();set.addAll(fomulaList);for(String str:set){System.out.println(str+"="+anticipate);}}else{// System.out.println("无解"); // }}// 判断两个数是否相等private static boolean isEqual(double d1,double d2){return Math.abs(d1-d2)<0.0001;}/*** 两个数进行四则运算的六种结果* @return*/private List<String> getFomulaList(){List<String> retval=new ArrayList<String>();if(isEqual(op1-op2,anticipate)){retval.add(op1+"-"+op2);}if(isEqual(op2-op1,anticipate)){retval.add(op2+"-"+op1);}if(isEqual(op1+op2,anticipate)){retval.add(op1+"+"+op2);}if(isEqual(op1*op2,anticipate)){retval.add(op1+"*"+op2);}if(isEqual(op1/op2,anticipate)){retval.add(op1+"/"+op2);}if(isEqual(op2/op1,anticipate)){retval.add(op2+"/"+op1);}return retval;}public static void main(String[] args){double[] arr1={3,6,9,12};Caculator c1=new Caculator(24,arr1);c1.printFomula();System.out.println("-----------");List<double[]> list=new ArrayList<double[]>();list.add(new double[]{});list.add(new double[] { 8, 3, 3, 8 });list.add(new double[] { 3, 7, 3, 7 });list.add(new double[] { 12, 12, 12, 10 });list.add(new double[] { 10, 10, 4, 4 });list.add(new double[] { 1, 4, 5, 6 });list.add(new double[] { 2, 2, 2, 9 });list.add(new double[] { 3, 4, 7, 8 });list.add(new double[] { 11, 11, 1, 5 });list.add(new double[] { 1, 2, 7, 7 });list.add(new double[] { 7, 7, 4, 4 });list.add(new double[] { 1, 4, 5, 6 });list.add(new double[] { 1, 3, 4, 6 });list.add(new double[] { 5, 5, 5, 1 });for(double[] arr:list){Caculator c=new Caculator(arr);c.printFomula();}} }
输出:
6.0/((9.0/12.0)/3.0)=24.0 12.0/((9.0/6.0)/3.0)=24.0 ((3.0*12.0)/9.0)*6.0=24.0 (12.0/(9.0/6.0))*3.0=24.0 (12.0/(9.0/3.0))*6.0=24.0 12.0-(3.0-(6.0+9.0))=24.0 ((12.0-3.0)+6.0)+9.0=24.0 ((3.0+9.0)*12.0)/6.0=24.0 ((3.0*12.0)*6.0)/9.0=24.0 ((3.0/9.0)*12.0)*6.0=24.0 (6.0/(9.0/3.0))*12.0=24.0 ((3.0*6.0)/9.0)*12.0=24.0 9.0-(3.0-(6.0+12.0))=24.0 ((12.0-3.0)+9.0)+6.0=24.0 ((6.0/9.0)*12.0)*3.0=24.0 ((9.0-3.0)*6.0)-12.0=24.0 ((9.0-3.0)+6.0)+12.0=24.0 12.0-((3.0-9.0)-6.0)=24.0 ((3.0/9.0)*6.0)*12.0=24.0 ((12.0+9.0)-3.0)+6.0=24.0 6.0-(3.0-(12.0+9.0))=24.0 ((3.0+9.0)/6.0)*12.0=24.0 (9.0-(3.0-12.0))+6.0=24.0 ((3.0*6.0)*12.0)/9.0=24.0 ((6.0-3.0)+12.0)+9.0=24.0 12.0/(6.0/(3.0+9.0))=24.0 ((6.0-3.0)+9.0)+12.0=24.0 ((12.0/9.0)*6.0)*3.0=24.0 12.0-((3.0-6.0)-9.0)=24.0 6.0-((3.0-9.0)-12.0)=24.0 9.0-((3.0-12.0)-6.0)=24.0 ((6.0/9.0)*3.0)*12.0=24.0 ((9.0+12.0)+6.0)-3.0=24.0 3.0/((9.0/12.0)/6.0)=24.0 (6.0-(3.0-12.0))+9.0=24.0 ((12.0/9.0)*3.0)*6.0=24.0 (3.0/(9.0/12.0))*6.0=24.0 ((9.0-3.0)+12.0)+6.0=24.0 (3.0/(9.0/6.0))*12.0=24.0 ((6.0*12.0)*3.0)/9.0=24.0 12.0/(9.0/(3.0*6.0))=24.0 (6.0-(3.0-9.0))+12.0=24.0 ((6.0+12.0)+9.0)-3.0=24.0 ((6.0+9.0)+12.0)-3.0=24.0 12.0/((9.0/3.0)/6.0)=24.0 6.0/(9.0/(3.0*12.0))=24.0 ((6.0*12.0)/9.0)*3.0=24.0 6.0-((3.0-12.0)-9.0)=24.0 (9.0-(3.0-6.0))+12.0=24.0 3.0/(9.0/(6.0*12.0))=24.0 9.0-((3.0-6.0)-12.0)=24.0 ((6.0+12.0)-3.0)+9.0=24.0 (12.0-(3.0-9.0))+6.0=24.0 6.0/((9.0/3.0)/12.0)=24.0 (6.0/(9.0/12.0))*3.0=24.0 (12.0-(3.0-6.0))+9.0=24.0 ((6.0+9.0)-3.0)+12.0=24.0 3.0/((9.0/6.0)/12.0)=24.0 ----------- 8.0/(3.0-(8.0/3.0))=24.0 ((3.0/7.0)+3.0)*7.0=24.0 12.0*12.0-12.0*10.0=24.0 ((10.0*10.0)-4.0)/4.0=24.0 6.0/((5.0/4.0)-1.0)=24.0 4.0/(1.0-(5.0/6.0))=24.0 ((2.0+9.0)*2.0)+2.0=24.0 ((9.0+2.0)*2.0)+2.0=24.0 8.0-((3.0-7.0)*4.0)=24.0 ((7.0-3.0)*4.0)+8.0=24.0 ((11.0*11.0)-1.0)/5.0=24.0 ((7.0*7.0)-1.0)/2.0=24.0 (4.0-(4.0/7.0))*7.0=24.0 6.0/((5.0/4.0)-1.0)=24.0 4.0/(1.0-(5.0/6.0))=24.0 6.0/(1.0-(3.0/4.0))=24.0 (5.0-(1.0/5.0))*5.0=24.0
本文转自张昺华-sky博客园博客,原文链接:http://www.cnblogs.com/xiandedanteng/p/3874030.html,如需转载请自行联系原作者
爪哇国新游记之二十一----快算24相关推荐
- 爪哇国新游记之二十六----迷宫寻路
代码: class Position{int x;int y;public Position(int x,int y){this.x=x;this.y=y;} } // 迷宫寻路 public cla ...
- 爪哇国新游记之二十四----二叉树
/*** 二叉树节点类* */ class Node<T extends Comparable> {public Node(T data){this.data=data;}T data;N ...
- 爪哇国新游记之二十八----从url指定的地址下载文件到本地
package download;import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; i ...
- 爪哇国新游记之二十五----图及其遍历查找
代码: import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java. ...
- 爪哇国新游记之二十九----访问URL获取输入流
代码: import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileWriter; import ...
- 爪哇国新游记之三十一----日期时间与字符串间的转化
1.由日期时间转化成字符串 Date date = new Date(); Format formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm ...
- 爪哇国新游记之三十二----邮件发送
由三个类完成任务,第一个为主,main中是用法示例. 纯邮件发送和带附件发送邮件皆可,大家请参照main函数中用法. package com.ufo.util.mail;import java.uti ...
- 爪哇国新游记之十一----用异常控制流程
import java.util.HashMap; import java.util.Map;public class LoginService{private Map<String,Strin ...
- 爪哇国新游记之三----自创动态数组类
package array;public class DArray{private int[] arr;private int currCount;private static final int I ...
最新文章
- exception in thread main java.lang.noclassdeffounderror wrong name
- css3动画之——动态的省略号
- pip Python 包安装和管理工具
- 史上最全,100+大数据开源处理工具汇总
- 吃透了这些Redis知识点,面试官一定觉得你很NB
- 什么是web2py框架?它有什么作用呢?
- 祝贺 在线文件管理系统 访问量 超过500
- 01 掌握运算符的分类 1204
- Java高级基础--阿里云Java复习
- c 语言中 十六进制数表达,c – 如何解释像0x0A这样的十六进制数?
- EPERM: operation not permitted, Please run SwitchHosts
- @程序员,快来速取硬核的汇编语言知识大全!
- laravel 与 tp5 获取控制器 方法名
- idea java代码格式化_IDEA java 代码格式化统一
- 2018java面试(1)- 自我介绍和项目介绍
- 开wifi微信定位服务器,企业微信wifi定位
- python中除以0的处理方法
- 【2022年度总结2023新年Flag】--2022:高考失利,我奋力奔跑的大一上;2023,朝着成为更优秀的自己迈进ing
- 南京大学的计算机到底怎么样?
- HDU 4417 Super Mario(划分树问题求不大于k的数有多少)