自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(54)
  • 收藏
  • 关注

原创 深入理解计算机时间系统-系统&硬件篇

上篇从日常代码出发,着重讨论了Java、MySQL等应用层中日期时间的表示和存储等操作、可能遇到的坑,及时区转换相关方法。下篇将尽量深入底层,看看我们在用及“日期时间”时,计算机中发生了什么。一. 奇怪的现象上篇中讲过 System.currentTimeMillis() 的用法,也提到了高频调用时会产生一定性能问题,我们先来看现象:用以下代码大致测量 System.currentTimeM...

2019-12-09 17:43:22 1362

原创 深入理解计算机时间系统-Java应用篇

文章目录1. 常识知识1.1. 时区1.2. 夏令时1.3. UTC和GMT2. Java关于日期时间的获取、表示及格式转换2.1. System.currentTimeMillis()2.2. System.nanoTime()2.3. java.util.Date2.4. java.sql.Date、java.sql.Time 和 java.sql.Timestamp2.5. java.ut...

2019-12-09 17:41:16 598

原创 分层理解Java字符串常量池

Java是一门计算机编程语言,但我们脑海中所理解的Java不仅仅是一门语言。它还包括Java虚拟机(JVM)的一系列规定,及具体Java产品(如Hotspot)的实现原理。不管我们日常在Java中用到的任何一种语法,都会由语言规范对其进行语义和用法上的规定,再由虚拟机规范进行实现方案上的约束和建议,最后由具体的产品进行编码实现。其中,语言规范和虚拟机规范是 Oracle 制定好的(),不同的Java产品(如Hotspot、JRockit、J9)等,对虚拟机规范的实现方式不尽相同。

2023-11-28 13:47:43 852

原创 深入理解Java内存模型理论

Java并发是一个很大的主题,包含很多方面的知识。本文从内存模型的角度分析,从概念理论上尽量精确理解Java内存模型,及其对并发的影响。文章目录一. 引入1. 并发的概念二. 内存模型的理解1. 什么叫内存模型2. 顺序一致性模型3. happens-before 模型4. Java内存模型 及 “因果关系”(Causality)三. 提炼理念1. 技术层次观念与思想方法的互通2. executed 和 exhibit 的区别,及双向视图一. 引入1. 并发的概念并发听起来是一个计算机术语,但计算机

2020-12-03 15:19:30 208

原创 synchronized 加锁相关问题

文章目录一. synchronized 关键字实现原理及应用方式简述1.1. 重量级锁的实现原理1.2. synchronized 代码块如何利用monitor1.3. synchronized 方法如何利用monitor二. 优化后的 synchronized 锁级别及锁升级2.1. 先修知识简述2.1.1. Java对象、对象头的组成2.1.2. JOL打印对象信息2.1.3. 大端小端字节序2.1.4. 对象信息打印示例2.2. 偏向锁相关实验2.2.1. 无锁2.2.2. 无偏向的偏向锁2.2.3.

2020-08-06 17:44:34 751 4

转载 【转载】数据库索引底层是怎么实现的

参考资料:数据库索引原理及优化—HeavenWang的专栏一、摘要本文以MySQL数据库为研究对象,讨论与数据库索引相关的一些话题。特别需要说明的是,MySQL支持诸多存储引擎,而各种存储引擎对索引的支持也各不相同,因此MySQL数据库支持多种索引类型,如BTree索引,哈希索引,全文索引等等。为了避免混乱,本文将只关注于BTree索引,因为这是平常使用MySQL时主要打交道的索引,至...

2018-07-08 00:12:48 6894

转载 【转载】如何提高服务器并发处理能力

转载自https://www.cnblogs.com/zengjin93/p/5569556.html什么是服务器并发处理能力一台服务器在单位时间里能处理的请求越多,服务器的能力越高,也就是服务器并发处理能力越强有什么方法衡量服务器并发处理能力吞吐率 吞吐率,单位时间里服务器处理的最大请求数,单位req/s从服务器角度,实际并发用户数的可以理解为服务器当前维护的代表...

2018-06-29 17:04:55 207

转载 【转载】提高网站性能的常见方法

转自https://blog.csdn.net/liuyang755855737/article/details/78238987一.Web前端性能优化 一般来说Web前端指网站业务逻辑之前的部分,包括浏览器加载,网站视图模型,图片服务,CDN服务等,主要优化手段有优化浏览器访问,使用反向代理,CDN等。 1..浏览器访问优化 (1)减少http请求 HTTP协议是无状态的应用层协议,...

2018-06-29 15:55:12 157

原创 Java序列化(持久化)

参考了菜鸟教程 和 天凉好个秋什么是Java序列化Java 提供了一种对象序列化的机制,该机制中,一个对象可以被表示为一个字节序列,该字节序列包括该对象的数据、有关对象的类型的信息和存储在对象中数据的类型。将序列化对象写入文件之后,可以从文件中读取出来,并且对它进行反序列化,也就是说,对象的类型信息、对象的数据,还有对象中的数据类型可以用来在内存中新建对象。使用场景一般情况下...

2018-05-12 16:54:07 824

转载 【转载】Java迭代器Iterator

转自http://cmsblogs.com/?p=1185迭代其实我们可以简单地理解为遍历,是一个标准化遍历各类容器里面的所有对象的方法类,它是一个很典型的设计模式。Iterator模式是用于遍历集合类的标准访问方法。它可以把访问逻辑从不同类型的集合类中抽象出来,从而避免向客户端暴露集合的内部结构。 在没有迭代器时我们都是这么进行处理的。如下:对于数组我们是使用下标来进行处理的:i...

2018-05-11 18:53:16 152

原创 Java网络编程

网络编程是指编写运行在多个设备(计算机)的程序,这些设备都通过网络连接起来。java.net 包中 J2SE 的 API 包含有类和接口,它们提供低层次的通信细节。你可以直接使用这些类和接口,来专注于解决问题,而不用关注通信细节。 java.net 包中提供了两种常见的网络协议的支持:TCP;UDP。 Socket通信URL处理HTTP通信Socket通信套接字使用TC...

2018-05-11 16:10:17 143

原创 Java IO流(Stream)、文件(File)

java IO

2018-05-10 16:44:30 144

原创 Java移位运算小结

左移(<<) 左移没有有符号和无符号之分。移除高位指定位数的同时在低位补零。有符号右移(>>) 若参与运算的数字为正数,则在高位补0;若参与运算的数字为负数,则在高位补1。实际上就是补原来最左面的数字。无符号右移(>>>) 不论参与运算的数字正负性,都在高位补0。注意:在对char,byte,short等类型进行移位操作前,编译...

2018-05-06 12:15:49 564

原创 关于值传递和引用传递的一个典型例子

深入理解引用传递public class Main { public static void changeStrBuffer(StringBuffer sb1, StringBuffer sb2) { sb1.append(" World"); sb2 = sb1; } public static void main(String[...

2018-05-06 11:15:44 2469

转载 【转】构造代码块

原文链接:https://blog.csdn.net/hspingcc/article/details/54893853Java中有四种代码块:普通代码块就是在方法后面使用”{}”括起来的代码片段,不能单独执行,必须调下其方法名才可以执行.静态代码块在类中使用static修饰,并使用”{}”括起来的代码片段,用于静态变量的初始化或对象创建前的环境初始化.同步代码块使用sy...

2018-05-05 17:30:43 119

原创 Java中static和final关键字

static关键字 Static关键字有四种使用情况:成员变量、成员方法、代码块、内部类。Static修饰的成员变量就成了类变量,随着类的加载而加载,生命周期和类一样。Static修饰的成员方法变成了类方法,可以直接通过类名调用。和.class一样存在于方法区。static变量和static方法可以被继承但是不能被重写(没有重写的概念)。static方法可以重载(静态不静态和重载不重载...

2018-05-05 16:15:06 159

转载 【转载】Java内部类详解

原文链接:http://www.cnblogs.com/dolphin0520/p/3811445.html内部类详解

2018-05-05 16:01:46 114

原创 LeetCode404. Sum of Left Leaves

题目Find the sum of all left leaves in a given binary tree.Example: 3 / \ 9 20 / \ 15 7There are two left leaves in the binary tree, with values 9 and 15 respectively. Retur...

2018-03-06 14:08:59 149

原创 LeetCode400. Nth Digit

题目Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, …Note: n is positive and will fit within the range of a 32-bit signed integer.Example 1:Input:3Ou...

2018-03-01 20:23:25 124

原创 LeetCode383. Ransom Note

383. Ransom Note

2018-03-01 18:40:49 141

原创 LeetCode342. Power of Four

问题Given an integer (signed 32 bits), write a function to check whether it is a power of 4.Example: Given num = 16, return true. Given num = 5, return false.Follow up: Could you solve it without...

2018-02-27 21:17:51 182

原创 LeetCode290. Word Pattern

问题Given a pattern and a string str, find if str follows the same pattern.Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in str.Ex...

2018-02-27 15:48:16 111

原创 LeetCode278. First Bad Version

问题You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on...

2018-02-27 10:15:17 67

原创 LeetCode268. Missing Number

268. Missing Number

2018-02-27 09:41:25 113

原创 LeetCode190. Reverse Bits

题目Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 0011100

2018-02-05 22:25:48 125

转载 Java内部类学习

本文为参考慕课的学习笔记概念定义 内部类( Inner Class )就是定义在另外一个类里面的类。与之对应,包含内部类的类被称为外部类。作用 内部类提供了更好的封装,可以把内部类隐藏在外部类之内,不允许同一个包中的其他类访问该类内部类的方法可以直接访问外部类的所有数据,包括私有的数据内部类所实现的功能使用外部类同样可以实现,只是有时使用内部类更方便分类 成员内部类静态内

2018-02-01 11:00:43 146

原创 LeetCode169. Majority Element

题目Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element

2018-01-31 12:32:52 102

原创 LeetCode167. Two Sum II - Input array is sorted

题目Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numb

2018-01-29 17:19:19 153

原创 LeetCode160. Intersection of Two Linked Lists

题目Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: a1 → a2 ↘

2018-01-29 12:41:28 97

原创 LeetCode141. Linked List Cycle

题目Given a linked list, determine if it has a cycle in it.Follow up: Can you solve it without using extra space?解答一般思路:HashSetpublic class Solution { public boolean hasCycle(ListNode hea

2018-01-23 11:27:20 100

原创 LeetCode136. Single Number

题目Given an array of integers, every element appears twice except for one. Find that single one.Note: Your algorithm should have a linear runtime complexity. Could you implement it without using e

2018-01-23 11:23:39 118

原创 LeetCode121. Best Time to Buy and Sell Stock

题目Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock

2018-01-22 19:20:58 197

原创 LeetCode108. Convert Sorted Array to Binary Search Tree

题目Given an array where elements are sorted in ascending order, convert it to a height balanced BST.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of

2018-01-21 21:54:23 115

原创 LeetCode110. Balanced Binary Tree

题目Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never dif

2018-01-21 21:49:52 162

原创 LeetCode101. Symmetric Tree

题意: Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree [1,2,2,3,4,4,3] is symmetric: 1 / \ 2 2 / \ / \3 4 4

2018-01-20 09:01:44 130

原创 二叉树的遍历(Java实现)

列举了二叉树的前序、中序、后序的递归和非递归遍历方法,以及层次遍历、分层输出的层次遍历方法。举例如下: import java.util.LinkedList;import java.util.List;import java.util.Queue;import java.util.Stack;public class Main { public static vo

2018-01-19 14:43:46 18114

原创 LeetCode_21. Merge Two Sorted Lists

题目Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.Example:Input: 1->2->4, 1->3->4 Output: 1->1->2->3

2018-01-12 17:35:19 145

原创 Hadoop_1 Hadoop概述和MapReduce简介

Hadoop的前世今生处理海量数据时,为了降低成本,使用普通PC机,将硬件损坏视为常态,通过软件来保证可靠性。Hadoop的核心组成: HDFS:分布式文件系统,存储海量数据;MapReduce:并行处理框架,实现任务处理和调度。Hadoop的作用:搭建大型数据仓库,进行PB级数据处理。HDFSHDFS(Hadoop Distributed File System)HDFS文件被拆分成

2017-12-10 09:51:09 524

原创 Java学习_String类型转换等问题

String和其他数据类型转换

2017-11-28 23:35:09 568

转载 HashMap&HashSet学习链接记录

HashMap&HashSet

2017-11-10 09:02:45 162

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除