随笔

3.SQL 查询语句:给一个字段,对其进行从大到小排序,取前十行
select grade from student order by grade desc limit 0,3;
5.有两个字符串类型的数字,实现一个方法将它们进行相加,并返回相加后的数值
public static int parseInt(String s, int radix)
throws NumberFormatException
{
/*
* WARNING: This method may be invoked early during VM initialization
* before IntegerCache is initialized. Care must be taken to not use
* the valueOf method.
*/
     // 第一步、判断字符串参数是否为null
if (s == null) {
throw new NumberFormatException(“null”);
}
     
     // 第二步,判断基数是否小于最小基数 为2
if (radix < Character.MIN_RADIX) {
throw new NumberFormatException(“radix " + radix +
" less than Character.MIN_RADIX”);
}

// 第三步,判断基数是否大于最大基数 为36
if (radix > Character.MAX_RADIX) {
throw new NumberFormatException(“radix " + radix +
" greater than Character.MAX_RADIX”);
}

    int result = 0;

// 标识,是否为负数,默认false
boolean negative = false;
// 字符串转换为char数组后的 下标和数组长度
int i = 0, len = s.length();
int limit = -Integer.MAX_VALUE;
int multmin;
int digit;

    // 第四步,判断字符串长度是不大于0
    if (len > 0) {

// 取第一个字符
char firstChar = s.charAt(0);
       // 字符ASCII是否小于’0’ ,可能为 ‘+’ ‘-’ , 如果不是<‘0’ ,则为数组 ,略过该if{}
if (firstChar < ‘0’) { // Possible leading “+” or “-”
// 如果第一个字符是’-’ ,说明是负数,则负数标识改为true ,限制改为最小标识
          if (firstChar == ‘-’) {
negative = true;
limit = Integer.MIN_VALUE;
} else if (firstChar != ‘+’)
            // 如果第一个字符不是’-’ 也不是’+’ ,异常
throw NumberFormatException.forInputString(s);
          // 第一字符<‘0’ 且长度为1 则不是数字 异常
if (len == 1) // Cannot have lone “+” or “-”
throw NumberFormatException.forInputString(s);
i++;
}
multmin = limit / radix;
       // 遍历字符串转为的字符数组,将每一个字符转为10进制值,并拼接
while (i < len) {
// Accumulating negatively avoids surprises near MAX_VALUE
digit = Character.digit(s.charAt(i++),radix);
if (digit < 0) {
throw NumberFormatException.forInputString(s);
}
if (result < multmin) {
throw NumberFormatException.forInputString(s);
}
result *= radix;
if (result < limit + digit) {
throw NumberFormatException.forInputString(s);
}
result -= digit;
}
} else {
throw NumberFormatException.forInputString(s);
}
     // 返回拼接数据
return negative ? result : -result;
}
6.HTTP的返回有几种状态码,2几几,3几几,4几几,5几几,分别是什么意思
100 - Continue 初始的请求已经接受,客户应当继续发送请求的其余部分
200 - OK 一切正常,对GET和POST请求的应答文档跟在后面。
400 - Bad Request 请求出现语法错误。
403 - Forbidden 资源不可用。服务器理解客户的请求,但拒绝处理它
500 - Internal Server Error 服务器遇到了意料不到的情况,不能完成客户的请求。
502 - Bad Gateway 服务器作为网关或者代理时,为了完成请求访问下一个服务器
7.某一个端口的占用情况
netstat -anp |grep 8089
8.创建文件
cat >>filename ,touch ,mkidr -p a/b/c/d
在这里插入图片描述在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值