Convert InputStream to BufferedReader in Java
The BufferedReader reads characters; while the InputStream is a stream of bytes. The BufferedReader can’t read the InputStream directly; So, we need to use an adapter like InputStreamReader to convert…
How to copy file in Java
This article shows four ways to copy a file in Java: (1) Files.copy (NIO), (2) Apache Commons IO, (3) Guava, (4) Plain Java. In Java 7+, the NIO Files.copy is…
How to get file last modified date in Java
In Java, we can use Files.readAttributes() to get the file metadata or attribute, and then lastModifiedTime() to display the last modified date of a file. For legacy IO, we can…
Java – Check if a String contains a substring
In Java, we can use String.contains() to check if a String contains a substring. We can also check the substring by using indexOf().
How to convert String to Char Array
In this article, we will examine some example to convert String to Char array vise verse.
Java StringTokenizer examples
In Java, we use StringTokenizer to split a string into multiple tokens. The StringTokenizer is a legacy class, try the split method of String.
How to pad a String in Java?
This article shows you how to use the JDK1.5 String.format() and Apache Common Lang to left or right pad a String in Java.
Java String Format Examples
This article shows you how to format a string in Java, via String.format(). We will examine how to control String format with argument, how to format Integer, Floating Points as…
How to format FileTime in Java
In Java, we can use DateTimeFormatter to convert the FileTime to other custom date formats.