How to convert String to Integer in Java
In Java, we can use Integer.valueOf(String) to convert a String to an Integer object; For unparsable String, it throws NumberFormatException. We will examine deeply on how to convert a String…
Favourite tutorials for developers
Java is a high-level, class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible. It is a general-purpose programming language intended to let programmers write once, run anywhere (WORA), meaning that compiled Java code can run on all platforms that support Java without the need to recompile.
In Java, we can use Integer.valueOf(String) to convert a String to an Integer object; For unparsable String, it throws NumberFormatException. We will examine deeply on how to convert a String…
Few Java examples to show you how to check if a String is numeric. We have several ways to check numeric string: using Character.isDigit(), using NumberUtils.isDigits() from Apache Commons Lang
In Java, we can use String#split() to split a string. We will examine deeply many ways or options to split a string.
In Java, we use equals() to compare string value. In this article, we will show you a few ways to compare strings in Java: using equals(), using equalsIgnoreCase(), using contentEquals(),…
The Java String compareTo() method compares two strings lexicographically (alphabetical order). It returns a positive number, negative number, or zero. if s1 < s2, it returns negative number. if s1…
In Java, we can use str.getBytes(StandardCharsets.UTF_8) to convert a String into a byte. And we can use new String(bytes, StandardCharsets.UTF_8) to convert byte to a String.
In Java, we can use new String(bytes, StandardCharsets.UTF_8) to convert a byte to a String. For text or character data, we use new String(bytes, StandardCharsets.UTF_8) to convert the byte to…
Here are a few Java examples of converting between String or ASCII to and from Hexadecimal. Apache Commons Codec – Hex, Integer, Bitwise
In this tutorial, we show you how to convert an IP address to its decimal equivalent in Java, and vice versa. We show you two ways to convert an IP…
The MD5, defined in RFC 1321, is a hash algorithm to turn inputs into a fixed 128-bit (16 bytes) length of the hash value. In Java, we can use MessageDigest…