• Convert BufferedImage to Image in Java
    14 February

    Convert BufferedImage to Image in Java

    In this post, we will see how to convert BufferImage to Image in java. Convert BufferedImage to Image in Java BufferedImage is an Image, so you don’t need to do any conversion. You can just assign it as below: BufferedImage bufferedImage = ImageIO.read(file); Image img = bufferedImage; Convert java.awt.image.BufferedImage to javafx.scene.image.Image in java You can […]

  • Convert byte array to base64 String in java
    12 February

    Convert Byte Array to Base64 String in Java

    In this article, we will see how to convert byte array to base64 String in java. Using Base64 to Convert Byte Array to Base64 String in Java [ Java 8+] Java 8 has finally introduced Base64 functionalities via java.util.Base64 class. You can use Base64's encode() method to convert Byte Array to Base64 String in Java. […]

  • Escape percent sign in java
    08 February

    Escape percent sign in String’s format method in java

    In this post, we will see how to escape Percent sign in String’s format() method in java. Escape Percent Sign in String’s Format Method in Java String’s format() method uses percent sign(%) as prefix of format specifier. For example: To use number in String’s format() method, we use %d, but what if you actually want […]

  • Print CLASSPATH in java
    08 February

    Print Classpath in Java

    In this post, we will see how to print CLASSPATH in java. 💡 Outline You can use System.getProperty("java.class.path") to get ClassPath in java. String classpath = System.getProperty("java.class.path"); String[] classPathValues = classpath.split(File.pathSeparator); System.out.println(Arrays.toString(classPathValues)); What is CLASSPATH in java CLASSPATH variables tell application to location where it should find user classes. Default CLASSPATH is current working directory(.). […]

  • Get unicode value of character in java
    07 February

    Get Unicode Value of Character in Java

    In this post, we will see how to get unicode value of character in java. Get Unicode Value of Character in Java You can simply use below code to get unicode value of character in java. private static String getUnicodeCharacterOfChar(char ch) { return String.format("\\u%04x", (int) ch); } Here is complete example to print unicode value […]

  • 07 February

    Get number of days in Month in java

    Learn about how to get number of days in Month in java. Get number of days in Month in java Using YearMonth’s lengthOfMonth() [Java 8] You can use YearMonth‘s lengthOfMonth() method to get number of days in Month in java. Pass Year and month to YearMonth’s of and create YearMonth object. Call lengthOfMonth() on YearMonth’s […]

  • Get last day of month in java
    04 February

    Get last day of Month in java

    Learn about how to get last day of month in java. There are times when you need to get last day of month to process data at the end of each month. For example: Processing salaries of the employee in your company. There are multiple ways to get last day of month in java Ways […]

  • Find character in String in java
    02 February

    Find Character in String in Java

    In this post, we will see how to find character in String in java. How to Find Character in String in Java There are multiple ways to find char in String in java 1. Using indexOf() Method to Find Character in String in Java indexOf() method is used to find index of substring present in […]

  • 02 February

    Remove Comma from String in Java

    Learn about how to remove comma from String in java. Remove comma from String in java 1. Using replace() method You can use String’s replace() method to remove commas from String in java. Here is syntax of replace method: public String replace(CharSequence target, CharSequence replacement) package org.arpit.java2blog; public class RemoveCommaFromStringMain { public static void main(String[] […]

Subscribe to our newletter

Get quality tutorials to your inbox. Subscribe now.