File Change Notification with Watch Service API

Since Java 7, the java.nio.file package adds a feature: file change notification with Watch Service API – java.nio.file.WatchService. Watch Service API allows us to register directories with the watch service, and monitor the directories and files for any changes including creation, deletion, modification etc. The post will briefly introduce the usage of Watch Service API. Continue reading

Palindrome Number – LeetCode

Problem

Determine whether an integer is a palindrome. Do this without extra space.

Some hints:
1. Could negative integers be palindromes? (ie, -1)
2. If you are thinking of converting the integer to string, note the restriction of using extra space.
3. You could also try reversing an integer. However, if you have solved the problem “Reverse Integer”, you know that the reversed integer might overflow. How would you handle such case?
Continue reading