FormatStyle values() method in Java with Examples Last Updated : 18 Aug, 2021 Comments Improve Suggest changes Like Article Like Report The values() method of FormatStyle enum is used to an array containing the units of this FormatStyle, in the order, they are declared.Syntax: public static FormatStyle[] values() Parameters: This method accepts nothing.Return value: This method returns an array containing the constants of this enum type, in the order, they are declared.Below programs illustrate the FormatStyle.values() method: Program 1: Java // Java program to demonstrate // FormatStyle.values() method import java.time.format.FormatStyle; public class GFG { public static void main(String[] args) { // Get FormatStyle instance FormatStyle formatStyle = FormatStyle.valueOf("FULL"); // Get the constants using values() FormatStyle[] array = formatStyle.values(); // Print the values for (int i = 0; i < array.length; i++) System.out.println(array[i]); } } Output: FULL LONG MEDIUM SHORT Program 2: Java // Java program to demonstrate // FormatStyle.values() method import java.time.format.FormatStyle; public class GFG { public static void main(String[] args) { // Get FormatStyle instance FormatStyle formatStyle = FormatStyle.valueOf("FULL"); // Get the constants using values() FormatStyle[] array = formatStyle.values(); // Print the values System.out.println("FormatStyle length: " + array.length); } } Output: FormatStyle length: 4 References: https://docs.oracle.com/javase/10/docs/api/java/time/format/FormatStyle.html Comment More infoAdvertise with us Next Article FormatStyle values() method in Java with Examples A AmanSingh2210 Follow Improve Article Tags : Java Java-Functions java.time.format package Java-FormatStyle Practice Tags : Java Similar Reads Float shortValue() method in Java with examples The shortValue() method in Float Class is a built-in method in Java which returns the value specified by calling the object as short after typecasting.Syntax: public short shortValue() Return Value: It return the value of FloatObject as short.Below programs illustrate shortValue() method in Java: Pr 2 min read Number.floatValue() method in java with examples The floatValue() method is an inbuilt method in Java from the java.lang.Number class. This method is used when we want to extract the value of a Number object as a float data type. This may involve rounding or truncation, because this method returns the numeric value of the current object converted 2 min read Map Values() Method in Java With Examples Map Values() method returns the Collection view of the values contained in this map. The collection is backed by the map, so changes to the map are reflected in the collection, and vice-versa. Syntax: map.values() Parameter: This method does not take any parameter. Return value: It returns a collect 2 min read Short floatValue() method in Java with Example The java.lang.Short.floatValue() method of Short class is a built in method in Java which is used to return the value of the Short object as a float. Syntax: public float floatValue() Return type: It return the value of ShortObject as float. Below is the implementation of floatValue() method in Java 2 min read TreeMap values() Method in Java with Examples In Java, the values() method of the TreeMap class is present inside java.util package which is used to create a collection out of the values of the map. It basically returns a Collection view of the values in the TreeMap. --> java.util package --> TreeMap class --> values() Method Syntax: T 2 min read Like