![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
java
BINGXIHEART
这个作者很懒,什么都没留下…
展开
-
链表队列 顺序队列(基于数组) 循环队列(基于数组)
链表队列public class QueueBasedOnLinkedList { public static class Node { int data; Node next; public Node(int data, Node next) { this.data = data; this.next = next; } public int getData(原创 2020-12-16 11:45:53 · 131 阅读 · 0 评论 -
转载:java运算符 与(&)、非(~)、或(|)、异或(^)
转载自https://www.cnblogs.com/yesiamhere/p/6675067.html最近看HashMap源码,遇到了这样一段代码:1 static final int hash(Object key) {2 int h;3 return (key == null) ? 0 : (h = key.hashCode()) ^ (h >>> 16);4 }于是我整理学习了以下知识:1.十进制转二进制原.转载 2020-12-11 11:01:42 · 190 阅读 · 0 评论 -
java 二分查找
/** * 对不存在重复元素的数组 查找某元素 * 简单二分查找 * * @param a * @param n * @param target * @return */ public static int simpleBinarySearch(int[] a, int n, int target) { int low = 0; int high = n - 1; wh..原创 2020-12-08 10:01:44 · 153 阅读 · 0 评论 -
Kotlin 构造方法的参数var val 和 什么都没有的区别
转载自https://www.cnblogs.com/gloryhope/p/10485515.html1.什么都没有,在该类中使不能使用的, 这个参数的作用就是,传递给父类的构造方法class IdCard(number: Long, name: String) {}对应的java代码public final class IdCard { public IdCard(long number, @NotNull String name) { Intrinsics.che...转载 2020-11-18 17:20:12 · 1085 阅读 · 0 评论 -
Java异常分类
大致分为以下类别 -1.检测异常 -扩展Throwable类(除了RuntimeException和Error)的类称为检查异常egIOException,SQLException等。检查的异常在编译时检查。一个典型的情况是FileNotFoundException2.未经检查的异常 -扩展RuntimeException的类称为未检查异常,未检查的异常在编译期不检查,而是在运行时检查。例如,ArithmeticException,NullPointerException,ArrayIndex原创 2020-10-14 11:57:26 · 132 阅读 · 0 评论 -
原码 反码 补码
一直搞不清楚负数的原码是怎么计算的,特此记录原码左边第一位为符号位,0为正, 1为负7原码 0 0000111-7原码 1 0000111反码正数的反码与其原码相同负数的反码是对其原码逐位取反,但符号位除外7原码 0 00001117反码 0 0000111-7原码 1 0000111-7反码 1 1111000补码...原创 2019-09-23 17:19:48 · 1343 阅读 · 0 评论 -
java String StringBuffer StringBuilder执行速度区别
long s1 = System.currentTimeMillis(); int n = 10000; String str = ""; for (int i = 0; i < n; i++) { str += ("-" + i); } System.out.println("Stri...原创 2019-12-02 08:39:29 · 164 阅读 · 0 评论 -
JavaEE response forward 和 redirect 区别
* 重定向的特点:redirect 1. 地址栏发生变化 2. 重定向可以访问其他站点(服务器)的资源 3. 重定向是两次请求。不能使用request对象来共享数据 实现方法 response.sendRedirect("/xx/xxx/xxx"); * 转发的特点:forward 1. 转发地址栏路径不变 2. 转发只能访...原创 2019-11-08 11:57:00 · 192 阅读 · 0 评论 -
java String split(".") 与 split("\\.")
String s = "XXX.YYY.ZZZ";System.out.println(s.split("\\.").length); //结果是3System.out.println(s.split(".").length);//结果是0public String[] split(String regex) { //只写.分割不出来 正则表达式中.有特殊含义 retur...原创 2019-10-24 09:27:30 · 219 阅读 · 0 评论