日期:2014-05-20 浏览次数:20703 次
package com.lihan; public class testNum { public Long sum(Long[] i){ Long max=i[0]; for(int k=0;k<i.length;k++) { if(i[k]>max) { max=i[k]; } } return max; } /** * @param args * @author 李晗 */ public static void main(String[] args) { String[] num={"13712345671","13712345672","13712345673","13712345674","13712345675","13712345676","13712345677","13712345678"}; Long[] j=new Long[num.length]; for(int i=0;i<num.length;i++) { j[i]=Long.parseLong(num[i]); } testNum t=new testNum(); Long sum=t.sum(j); String str=String.valueOf(sum); String s=num[0]; for(int x=0;x<s.length();x++) { if(str.charAt(x)==s.charAt(x)) { System.out.print(str.charAt(x)); } } // TODO Auto-generated method stub } }