A handy utility method that will return the part of the day, such as morning, afternoon, evening, etc.
public static String getPartOfTheDay(final int hour)
if(hour > 4 && hour < 12)
if(hour <= 8)
return "Early Morning";
else if(hour > 8 && hour < 11)
return "Late Morning";
else if(hour >= 12 && hour < 17)
if(hour >= 13 && hour <= 15)
return "Early Afternoon";
else if(hour >= 16)
return "Late Afternoon";
else if(hour >= 17 && hour <= 21)
if(hour <= 19)
return "Early Evening";
The method is based on the following logic, that many people would agree with:
Morning: 5 to 12
- Early morning: 5 to 8
- Late morning: 11 to 12
Afternoon: 12 to 17
- Early afternoon: 13 to 15
- Late afternoon: 16 to 17
Evening: 17 to 21
Night: 21 to 4
Due to licensing issues, OpenSUSE comes with OpenJDK. I personally prefer using Oracle’s JDK. It’s worth mentioning that OpenJDK will not work in some cases such as building Android source code and it’s not recommended for Android development.
Here is how to install and setup Oracle JDK on OpenSUSE.
1. Download the JDK from Oracle’s site. I use 64-bit OpenSUSE so i downloaded the ‘Linux x64‘ version rpm. For 32 bit systems download the ‘i586′ version of the package.
2. Install the JDK by opening a terminal, becoming root and switching to the directory where you downloaded the RPM package.
For x64 version execute:
rpm -i jdk-8u5-linux-x64.rpm
For 32-bit version execute:
rpm -i jdk-8u11-linux-i586.rpm
3. Make the OracleJDK default system JDK.
While at the terminal and with root privileges execute the following sequence of commands:
update-alternatives --install /usr/bin/java java /usr/java/jdk1.8.0_05/bin/java 1551
update-alternatives --install /usr/bin/javadoc javadoc /usr/java/jdk1.8.0_05/bin/javadoc 1551
update-alternatives --install /usr/bin/jar jar /usr/java/jdk1.8.0_05/bin/jar 1551
update-alternatives --install /usr/bin/javap javap /usr/java/jdk1.8.0_05/bin/javap 1551
update-alternatives --install /usr/bin/javac javac /usr/java/jdk1.8.0_05/bin/javac 1551
update-alternatives --install /usr/bin/javaws javaws /usr/java/jdk1.8.0_05/bin/javaws 1551
update-alternatives --install /usr/bin/javah javah /usr/java/jdk1.8.0_05/bin/javah 1551
update-alternatives --install /usr/bin/jarsigner jarsigner /usr/java/jdk1.8.0_05/bin/jarsigner 1551
4. Define JAVA_HOME environment variable.
Type ‘exit‘ at the terminal to become your normal everyday user again. Open .bashrc in your favorite command line text editor and the following:
Save the file and exit from the editor. Type:
5. Verify Java version by typing ‘java -version‘ it should says “java version “1.8.0_05”“. If that’s the case you have OracleJDK correctly installed.