package ft;
import tool.*;
public class pro{
int s,datanumber;
String[] data=new String[4000];
String[] name=new String[4000];
int number;
double[] namex=new double[4000];
public static void main(String[] args) {
pro test=new pro();
}
pro(){
String str1="%20";
String id="1WbKBhU1MOp48d_WS23P4FLSqmCQO7wMbehAODrS8";
String urlx="https://www.googleapis.com/fusiontables/v1/query?sql=SELECT";
urlx=urlx+str1+"*"+str1+"FROM"+str1+id;
urlx=urlx+"&key=AIzaSyAH0WCAXRIdHdbI-6bnMSN4kVDDZZmGyqY";
getdata sub=new getdata();
sub.makedata(urlx,"UTF-8");
data=sub.data;
datanumber=sub.datanumber;
String str="";
for(s=1;s<datanumber+1;s++){
str=str+data[s];
}
str=str.replace("\"rows\": ","");
String[] x=str.split("],");
for(s=1;s<x.length;s++){
String[] y=x[s].split(",");
name[s]=y[2];
}
for(s=1;s<x.length;s++){
name[s]=cg(name[s]);
namex[s]=num(name[s]);
}
number=x.length-1;
number=number/3;
for(s=1;s<number+1;s++){
double p1=namex[3*s-2]+namex[3*s-1]+namex[3*s];
p1=p1/3;
System.out.println(p1);
}
}
double num(String str){
double nx;
nx=0;
try{
nx=Double.parseDouble(str);
}catch (Exception e) {}
return nx;
}
String cg(String c){
int p1=c.indexOf("\"");
int p2=c.indexOf("\"",p1+1);
if(p1>-1) c=c.substring(p1+1,p2);
return c;
}
}
最終更新:2016年10月22日 14:56