what does “>>>” mean in java?

The >>> operator is the unsigned right bit-shift operator in Java. It effectively divides the operand by 2 to the power of the right operand, or just 2 here. The difference between >> and >>> would only show up when shifting negative numbers. The >> operator shifts a 1 bit into the most significant bit if it was a 1, and the >>> shifts in a 0 regardless. UPDATE: Let’s average 1 and 2147483647 (Integer.MAX_VALUE). We can do the … Read more

typeof in Java 8

You can use the getClass() method to get the type of the object you are using: This will generate the following output: As you see it will show the type of the object which is referenced by the variable, which might not be the same as the type of the variable (Object in this case). For primitive types … Read more

Converting characters to integers in Java

The java.lang.Character.getNumericValue(char ch) returns the int value that the specified Unicode character represents. For example, the character ‘\u216C’ (the roman numeral fifty) will return an int with a value of 50. The letters A-Z in their uppercase (‘\u0041’ through ‘\u005A’), lowercase (‘\u0061’ through ‘\u007A’), and full width variant (‘\uFF21’ through ‘\uFF3A’ and ‘\uFF41’ through ‘\uFF5A’) forms have numeric values from 10 through 35. This is … Read more