• Get Parent Directory in Python
    20 February

    Get Parent Directory in Python

    Get parent directory in python. A simple way to understand the parent directory is to think of it as a directory that is at a higher position in the hierarchy from the specified directory. All the directories must have a parent directory, with the root directory being the only exception to this statement. This tutorial […]

  • Java LocalDate to Instant
    17 February

    Convert LocalDate to Instant in Java

    In this article, we will see how to convert LocalDate to Instant in Java. Java LocalDate to Instant Instant class provides an instantaneous point in time. When you want to convert LocalDate to Instant, you need to provide time zone. Using toInstant() wth ZoneId ZoneDateTime’s toInstant() method can be used to convert LocalDate to Instant. […]

  • Java Instant to LocalDate
    17 February

    Convert Instant to LocalDate in Java

    1. Overview In this article, we will see how to convert Instant to LocalDate in java. An Instant represents a specific moment in time in the UTC timezone, whereas a LocalDate represents a date without time or timezone information. The challenge is to extract the date part from an Instant object and represent it as […]

  • Convert String to LocalDateTime in Java
    17 February

    Convert String to LocalDateTime in Java

    In this article, we will see how to convert String to LocalDateTime in Java. LocalDateTime class was introduced in Java 8. LocalDateTime represents local date and time without timezone information. It is represented in ISO 8601 format (yyyy-MM-ddTHH:mm:ss) by default. Java String to LocalDateTime To convert String to LocalDateTime in Java, LocalDateTime provides static method […]

  • Java LocalDateTIme to String
    16 February

    Format LocalDateTime to String in Java

    In this article, we will see how to format LocalDateTime to String in java. Java LocalDateTime To String To format LocalDateTime to String, we can create DateTimeFormatter and pass it to LocalDateTime’s format() method. [crayon-678c724048d4e568526050/] Here are steps: Get LocalDateTime instance Create DateTimeFormatter instance with specified format Pass above DateTimeFormatter to format() method to convert […]

  • Convert OutputStream to byte array in java
    16 February

    Convert Outputstream to Byte Array in Java

    In this post, we will see how to convert OutputStream to Byte array in Java. Convert OutputStream to Byte array in Java Here are steps to convert OutputStream to Byte array in java. Create instance of ByteArrayOutputStream baos Write data to ByteArrayOutputStream baos Extract byte[] using toByteArray() method. [crayon-678c724048e2a764071213/] Output: Print output: Java2blog Convert OutputStream […]

  • 16 February

    Remove Backslash from String in Python

    1. Introduction to the Problem Statement In Python, working with strings containing special characters such as backslashes (\) is a frequent occurrence. Whether it’s for cleaning data or preparing strings for further processing, understanding how to effectively remove these characters is essential. Consider the string “This is a test\\string with\\backslashes\\”, where our goal is to […]

  • Convert BufferedImage to byte array in Java
    15 February

    Convert BufferedImage to Byte Array in Java

    In this article, we will see how to convert BufferedImage to Byte Array in Java. 💡 Outline To convert BufferedImage to byte array, you can use below code: [crayon-678c7240490e9411994122/] Java BufferedImage to Byte Array Here are steps to convert BufferedImage to Byte Array in java: Create instance of ByteArrayOutputStream baos. Call ImageIo.write() with bufferedImage, formatName […]

  • Convert byte array to BufferedImage in java
    14 February

    Convert Byte Array to BufferedImage in Java

    In this article, we will see how to convert byte array to BufferedImage in java. 💡 Outline To convert byte array to BufferedImage, you can use below code: [crayon-678c72404919b250432115/] Convert byte array image to BufferedImage in java Using ByteArrayInputStream Here are steps to convert byte array to BufferedImage in java. Create ByteArrayInputStream object by passing […]