ποΈ Convert String to int in Java
learned to parse a string (decimal, octal and hexadecimal) to int or Integer types using Integer.parseInt(), valueOf() and decode() methods.
ποΈ Convert int to String in Java (with Performance Comparison)
In Java, converting an int value to String is not difficult, but knowing which method may save us a few CPU cycles is worth knowing.
ποΈ Convert String to long in Java
Java examples of converting a String to a long type using Long.parseLong(String), Long.valueOf(String) and new Long(String) constructor.
ποΈ Convert long to String in Java
Java example to convert long to String in two different ways using String.valueOf(long l) and Long.toString(long l) methods. Both are static methods.
ποΈ Convert Date to String and String to Date in Java
Java example to convert Date to String and wise versa.
ποΈ Convert String to String[] in Java
Java examples to convert a string into string array using String.split() and java.util.regex.Pattern.slipt() methods.
ποΈ Join or Concatenate Strings with Comma in Java
Learn to join string array with delimiter to produce single string. Use listed java example to convert list of strings or array of strings to single string.
ποΈ Convert String to InputStream in Java
Java example to convert String to InputStream using ByteArrayInputStream and IOUtils classes. Writing String to InputSteam is a frequent job .
ποΈ Convert InputStream to String in Java
Learn to convert InputStream to String using Google guava IOβs ByteSource and CharStreams, BufferedReader, Scanner, and IOUtils classes.
ποΈ Split CSV String using Regex in Java
Learn to split string by comma or space and store in array or arraylist. Use given Java program to convert string to List in Java.
ποΈ Java Escape HTML β Encode Special Characters
Java examples to escape HTML using the StringEscapeUtils.escapeHtml4(), Springβs HtmlUtils.htmlEscape() and custom logic for special cases.
ποΈ How to Unescape HTML in Java
Java examples unescapes an HTML string to a string containing the actual Unicode characters using StringEscapeUtils and a custom method.
ποΈ Convert Byte[] to String and Vice-versa
Conversion between byte array and string may be used in many cases including IO operations, generate secure hashes etc.
ποΈ Convert Exception StackTrace to String in Java
Java program to convert error stack trace to String.
ποΈ Convert Float to String in Java
Learn to convert float value to String using Float.toString() and String.valueOf() methods and format float to n decimal points.