简单练习题

数字反转,不能使用字符串或其它工具类

     int num = 12345;
     int n = 0;
      do {
          n = (n * 10) + (num % 10);
          num = num / 10;
      } while (num > 0);
      System.out.println(n);//54321

基本类型和包装类型的对比

Integer a1 = new Integer(1);
Integer a2 = 1;
int a3 = 1;
System.out.println(a1 == a2);       // false
System.out.println(a1 == a3);       //true
System.out.println(a2 == a3);       //true
System.out.println(a1.equals(a2));  //true
System.out.println(a1.equals(a3));  //true
System.out.println(a2.equals(a3));  //true

最简单的分词算法

    public static void main(String[] args) {
        String work = "230078912345234";
        final int outLen = work.length();
        for (int i = 0; i < outLen; i++) {
            for (int j = i; j < outLen + 1; j++) {
                final String key = work.substring(i, j);
                System.out.println(key);
            }
        }
    }
2
23
230
2300
23005
230052
2300523
23005234

3
30
300
3005
30052
300523
3005234

0
00
005
0052
00523
005234

0
05
052
0523
05234

5
52
523
5234

2
23
234

3
34

4

自定义一个出栈入栈的代码

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值