git show remote url

There are two ways to show remote repository in git.

guava cache example

Cache is very important for the project. Redis or MemoryCache are good choose for distribution project. If you want use local cache for your project guava is a good choose. I will show you how to use guava cache in this page.

Java bitwise example

Java provides several bitwise operators: &, |, ^ and ~. This page shows you how to use them.

Java state pattern example

State Pattern is for the scenario which contains different states. Let's consider the state of Amazon orders. When you want buy goods from Amazon the logic flow is: create order -> pay -> send goods -> receive goods -> evaluate. The status of order is changed after every operation and the action of order is changed correspondingly. The example code is like following.

Java find nth Fibonacci number example

There are two ways to find nth Fibonacci number: recursion and loop. Recursion is easy to write but is inefficient. Loop is not easy to write but efficient.

Java initializing fields order

If you can not make sure the execution order of block, static-block and constructor. This blog will write a demo to help you understand the order of initializing fields.

Java algorithm tutorial

This series of blog describes common algorithms.

Java reversing single linked list

In this page I will show you how to reverse single linked list in loop. Before starting write logic we need defined Node class.

Linux find which Java thread consuming cpu

Sometimes Java process used 100% or 200% CPU. It depends on the core number of your CPU. If your CPU has 8 cores that means the highest usage of a process is 800%. When Java process consuming most CPU you can use the following steps to find which Java threads is consuming the most CPU.

Linux locate command example

locate command can help you to find the location of file in Linux. Before using locate you need use updatedb command to update the database. locate command searchs file name in database , find command searchs file in real time. locate is quicker than find.

HttpClient post form example

In this page I will show you how to post a form programmatically. Before testing HttpClient we need to write a API by Spring Boot(or use SpringMVC). The code is here.

Linux yum install rpm file locally

As we all known yum install can help you install the program easily. If the program doesn't exist in yum list you can download them and install locally.

Java find n'th node from the end of linked list

linked list is one the most common data structure. You can find the next node by current node, but you can not find the previous node by current(for single linked list). The question is how to find n'th node from the end of linked list.

Java binary search example

"Binary Search" is used for finding the target number in an ordered array. There are two ways to find the index of target number, recursion and looping. The example code is here.

Java ThreadLocalRandom example

ThreadLocalRandom is less contention and better performance than Random. If you need to use random number in multi-thread environment. The example code is here.