Wednesday, July 3, 2024
HomeLanguagesJavaDecimalFormat getMultiplier() method in Java

DecimalFormat getMultiplier() method in Java

The getMultiplier() method is a built-in method of the java.text.DecimalFomrat class in Java and is used to get the multiplier to be used in different formats like, percentage, percentile etc.

Syntax:

public int getMultiplier()

Parameters: The function does not accepts any parameter.

Return Value: The function returns the multiplier value to be used in different formats.

Below is the implementation of the above function:

Program 1:




// Java program to illustrate the
// getMultiplier() method
  
import java.text.DecimalFormat;
import java.util.Currency;
import java.util.Locale;
  
public class Main {
    public static void main(String[] args)
    {
  
        // Create the DecimalFormat Instance
        DecimalFormat deciFormat = new DecimalFormat();
  
        // Print the multiplier value
        System.out.println(deciFormat.getMultiplier());
    }
}


Output:

1

Program 2:




// Java program to illustrate the
// getMultiplier() method
  
import java.text.DecimalFormat;
import java.util.Currency;
import java.util.Locale;
  
public class Main {
    public static void main(String[] args)
    {
  
        // Create the DecimalFormat Instance
        DecimalFormat deciFormat = new DecimalFormat();
        deciFormat.getPercentInstance();
  
        // Print the multiplier value
        System.out.println(deciFormat.getMultiplier());
    }
}


Output:

1

Reference: https://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html#getMultiplier()

Nokonwaba Nkukhwana
Experience as a skilled Java developer and proven expertise in using tools and technical developments to drive improvements throughout a entire software development life cycle. I have extensive industry and full life cycle experience in a java based environment, along with exceptional analytical, design and problem solving capabilities combined with excellent communication skills and ability to work alongside teams to define and refine new functionality. Currently working in springboot projects(microservices). Considering the fact that change is good, I am always keen to new challenges and growth to sharpen my skills.
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments