java Byte原始碼分析
原始碼:
1 public static int toUnsignedInt(byte x) { 2 return ((int) x) & 0xff; 3 }
原理:
-128(byte) 原碼:10000000 反碼:11111111 補碼:10000000-128(byte)轉換為int型別: 10000000 -> 11111111 11111111 11111111 10000000 -128(int)& 0xff : 11111111 11111111 11111111 10000000 & 11111111 = 00000000 00000000 00000000 10000000
相關推薦
java Byte原始碼分析
原始碼: 1 public static int toUnsignedInt(byte x) { 2 return ((int) x) & 0xff; 3 } 原理: -128(byte) 原碼:10000000
Java集合原始碼分析03----ArrayList原始碼分析
目錄 簡介 ArrayList介紹(基於jdk1.8) 原始碼分析 案例 簡介 ArrayList位置java.util包下面,是List集合的一種,底層是動態陣列,它的容量能夠動態的增長。ArrayList是非同步的,只能在單執行緒中使用。 Arr
Java集合原始碼分析02----Collection集合
目錄 Collection框架綜述 Collection介面 Set介面 List介面 Queue介面 迭代器 -----------參考《Thank In Java》 Collection框架綜述 Collection是一個介面,分為常見的
Java集合原始碼分析01----集合框架
在java.util包下面提供了一些集合類,又稱為容器。相比長度固定,存放基本資料的陣列,集合的長度是可變的,並且存放的是物件的引用。Java集合框架學習大致可以分為五個部分:List列表,Set集合,Map對映,迭代器(Iterator,Enumeration),工具類(Arrays,Collec
java steam原始碼分析
前言 開發中喜歡使用stream的模式去處理資料流,因為其結合lambda讓程式碼更加簡潔,Stream的資料處理函式名也讓程式碼的邏輯一目瞭然。 抽象模型介紹 Stream stream介面是資料流轉各節點的抽象,下面是stream的部分方法 public interf
Java集合原始碼分析之LikedList
一、LinkedList結構 LinkedList是一種可以在任何位置進行高效地插入和移除操作的有序序列,它是基於雙向連結串列實現的。 LinkedList 是一個繼承於AbstractSequentialList的雙向連結串列。它也可以被當作堆疊、佇列或雙端佇列進行操作。
Java Future原始碼分析
JDK future框架,提供了一種非同步程式設計模式,基於執行緒池的。將任務runnable/callable提交到執行緒池executor,返回一個Future物件。通過future.get()獲取執行結果,這裡提交到執行緒池,後面的操作不會阻塞。future.get()獲取結果會阻塞,其實也是用多線執行
java srping 原始碼分析 深入理解低層設計思想
原始碼分析---SPRING 專案介紹 1. Spring框架簡介 作為應用程式開發人員,您可以從Spring平臺中受益的示例如下: 使Java方法在資料庫事務中執行,而不必處理事務API。 使本地Java方法成為HTTP端點,而無需處理Servlet
java集合原始碼分析(二)---ListIterator與Iterator
吐槽 早上起來刷牙洗臉洗頭髮後,正準備去上課,然後發現今天早上好像不上課emmmmmm,然後就早上繼續看下java集合方面的原始碼了吼吼吼 Iterator 上次好像說過一點這個,然後繼續複習下這個 還是先看下官方文件 然後我們發現這個東西就是個功能很少但很
Java LinkedList原始碼分析
(注:本文內容基於JDK1.6) 一、概述: LinkedList與ArrayList一樣實現List介面,只是ArrayList是List介面的大小可變陣列的實現,LinkedList是List介面連結串列的實現。基於連結串列實現的方式使得LinkedList在插入和刪
JAVA springMVC原始碼分析
就簡單的寫一寫,面試可能會問,我一箇中級java開發,不會太多東西,大佬繞道! 建立一個Servlet工程,分三層寫好: … 2.建立web.xml <?xml version="1.0" encoding="UTF-8"?> <disp
java編譯器原始碼分析之詞法分析器
java編譯器是什麼? 編譯簡單理解就是一種高階語言到另一種低階語言的翻譯過程;而執行這個過程的主體稱為編譯器。尋常所說的編譯器是指把組合語言轉變成機器語言,也稱目的碼,即CPU指令集。組合語言是一種比機器語言對人友好的語言,但不同機器硬體構造不一樣,驅動機器的
Java集合原始碼分析06----Stack原始碼分析
目錄 簡介 介紹 案例 簡介 Stack模擬的是棧的操作,繼承了Vector類,底層也是通過陣列來實現的。棧的資料特點是先進後出(FILO,First In Last Out),即最後壓入棧的元素,總是第一個彈出棧。由於Stack繼承了Vector,所以
java編譯器原始碼分析之語法分析器
token流到抽象語法樹的過程是語法分析。 前面認識到token流,這部分將介紹抽象語法樹(AST)。 那麼什麼是抽象語法樹(AST)?AST長啥樣?我們的token流是如何轉變成AST的?下面圍繞這三個問題展開討論。 針對什麼是抽象語法樹以及語法樹長啥樣兩個問
java集合原始碼分析(四)---LinkedList
吐槽 今天看到別人說的一句話感觸蠻深的一個人把時間用到哪裡,他的成就在那裡 自己最近真的蠻浮躁的,對自己的能力莫名其妙的錯誤估計,但實際上自己的真實的水平什麼的自己還是要有點B數,既然選擇這條路的話,還是好好的自己一步一步走下去吧。 LinkedList 這個是
java集合原始碼分析(三)--ArrayList原始碼
吐槽 週末啊,冷啊啊啊啊,然後怕自己週六中午睡起來都晚上了,就不睡午覺了去實驗室看下ArrayList的原始碼。 之前自己學集合只是簡單的看了下用法,寫專案的時候雖然用這塊但是也沒仔細看下這塊到底咋實現的。 ArrayList的基本功能 首先這個貨是個陣列 陣列
五種I/O模型和Java NIO原始碼分析
最近在學習Java網路程式設計和Netty相關的知識,瞭解到Netty是NIO模式的網路框架,但是提供了不同的Channel來支援不同模式的網路通訊處理,包括同步、非同步、阻塞和非阻塞。學習要從基礎開始,所以我們就要先了解一下相關的基礎概念和Java原生的NIO。這裡,就將最近我學習的知識總結一下,以供大
java集合原始碼分析(一)---整體
吐槽 這個月要把java的集合好好重新看下了,把上個月沒看的補上,突然發現自己寫了這麼久的安卓,集合那塊都忘的差不多了,自己看了下自己當時寫的集合的部落格,寫的真心爛唉。 自己當時學的時候的部落格 主要的目的是搞清楚集合底部的實現原理,和幾個的具體的區別 學習的
Java HashMap原始碼分析
put/get方法 package java.util; import java.io.*; public class HashMap<K,V> extends AbstractMap<K,V> implements Map<K,V>, Cloneable, Se
spring security java config 原始碼分析 parentAuthenticationManager
1 websecurity和httpsecurity的建立 java配置會使用2個註解 @Configuration @EnableWebSecurity 這個註解又匯入了WebSecurityConfiguration @Retention(value = java.l