服务热线:13616026886

技术文档 欢迎使用技术文档,我们为你提供从新手到专业开发者的所有资源,你也可以通过它日益精进

位置:首页 > 技术文档 > JAVA > 新手入门 > 基础入门 > 查看文档

一些非常有用的java常用方法( 2)


  int cint(float stsid){
     int cint = 0;
     try{
      int stsid1 = 0;
   if(stsid > 0){
      if((stsid - (int)stsid > 0) && (stsid - (int)stsid != 0.5))
         stsid1 = (int)(stsid + 0.5);
      if(stsid - (int)stsid == 0.5){
      if(((int)(stsid-0.5))%2 == 0)
         stsid1 = (int)(stsid - 0.5);
      else
            stsid1 = (int)(stsid + 0.5);
      }
            if(stsid - (int)stsid ==0)
      stsid1 = (int)stsid;
   }else{
      stsid = -stsid;
   if((stsid - (int)stsid > 0) && (stsid - (int)stsid != 0.5))
         stsid1 = - (int)(stsid + 0.5);
      if(stsid - (int)stsid == 0.5){
      if(((int)(stsid-0.5))%2 == 0)
         stsid1 = - (int)(stsid - 0.5);
      else
            stsid1 = - (int)(stsid + 0.5);
      }
            if(stsid - (int)stsid ==0)
      stsid1 = - (int)stsid;
   }
   cint = stsid1;
  }catch(exception e){}
  return cint;
  }

long clng(float numb){
     int nu = 0;
     long clng = 0;
     try{
        nu = cint(numb);
        clng = (long) nu;
     }catch(exception e){}
     return clng;
}

float dealfloat(string s){
    s=dealnull(s);
    if (s.equals(""))
return 0;
    return float.parsefloat(s);
}

string[] split(string source,string div){
      int arynum = 0,intidx=0,intidex=0,div_length = div.length();     
      if(source.compareto("")!=0){      
        if(source.indexof(div)!=-1){       
         intidx = source.indexof(div);        
         for(int intcount =1 ; ; intcount++){        
           if(source.indexof(div,intidx+div_length)!=-1){
             intidx= source.indexof(div,intidx+div_length);
             arynum = intcount;
             }
           else {arynum+=2;break;}
            }                    
       }else arynum =1;
      }else arynum = 0;
     
      intidx=0;
      intidex=0;
      string[] returnstr = new string[arynum];
     
      if(source.compareto("")!=0){
      
       if(source.indexof(div)!=-1){
       
        intidx = (int)source.indexof(div);
        returnstr[0]= (string)source.substring(0,intidx);
      
        for(int intcount =1 ; ; intcount++){
           if(source.indexof(div,intidx+div_length)!=-1){
             intidex=(int)source.indexof(div,intidx+div_length);
             
             returnstr[intcount] = (string)source.substring(intidx+div_length,intidex);
             
             intidx = (int)source.indexof(div,intidx+div_length);
             }
           else {
                returnstr[intcount] = (string)source.substring(intidx+div_length,source.length());
                break;
                }
            }
      }
      else {returnstr[0] = (string)source.substring(0,source.length());return returnstr;}
     }
     else {return returnstr;}                  
    return returnstr;    
}


public class stc_rsyb_name
  {
    public int pos = -1;
    public string name = "";
    public string host = "";
    public string home1 = "";
    public string home2 = "";
    public string home3 = "";
  }
  public class stc_syb_inf
  {
    string reg_name  = "";
    string g_syb = "";
    string r_syb = "";
  }
file://输出空格
void showblank(int num,jspwriter out){
try{
for(int i=0;i<=num;i++)
  out.print(" ");
}
catch(exception e){}  
}


   string g_syb_mk(){
     string g_syb_mk = nul

扫描关注微信公众号