码迷,mamicode.com
首页 > 编程语言 > 详细

使用java和javascript判断当前浏览者的操作系统 - 日记

时间:2020-04-20 01:27:19      阅读:72      评论:0      收藏:0      [点我收藏+]

标签:bre   网站   void   后台   lan   round   ida   href   blank   

今天访问了某一网站,看到了这一功能.可以判断出当前浏览者的操作系统,并且是32的还是64的.感觉这一功能挺不错,于是便研究了一下.分享给大家.

如果你做的是系统型应用系统(后台系统),此代码可以无视,可以用不到。但是如果你做的是互联网型(网站,带站点的)这可能会用到. 

 

 

public static void main(String[] args) {    
        //String s = RandomNum.getRandomNumStr(5);
        //System.out.println(s);
        System.out.println("生成5个含有5个字符的字符串:");
        RandomNum.SuiJiZiFuChuan(5,5);
        System.out.println("生成3个含有6个字符的字符串:");
        RandomNum.SuiJiZiFuChuan(6,3);
        System.out.println("生成任意1到20个含有任意1到10个字符的字符串:");
        RandomNum.SuiJiZiFuChuan((int)(20*Math.random()),(int)(10*Math.random()));
        System.out.println("随机性生成字符:");
        int i=0;
        while(i<(int)(10*Math.random())){
            RandomNum.SuiJiZiFuChuan((int)(20*Math.random()),1);
            i++;
        }
    }    

    public static void SuiJiZiFuChuan(int x,int y){
        for(int j=0;j<y;j++){
            for(int i=0;i<x;i++){
                int a=(int)(100*Math.random()+100*Math.random());
                while(true){
                    if(a>96&a<123)
                        break;
                    else
                        a=(int)(100*Math.random()+100*Math.random());
                }
                System.out.print((char)a);
            }
            System.out.println();
        }
    }

 

 

这是java做的.

技术图片

下载下来,可以直接加入到项目中运行.无需要任何jar包

使用java和javascript判断当前浏览者的操作系统 - 日记

标签:bre   网站   void   后台   lan   round   ida   href   blank   

原文地址:https://www.cnblogs.com/zhaoyanchun44/p/12735240.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!