Mega Code Archive

 
Categories / Java Tutorial / Development
 

To show negative numeric output inside parentheses, rather than with a leading -, use the ( flag

import java.util.Formatter; public class MainClass {   public static void main(String args[]) {     Formatter fmt = new Formatter();     fmt.format("%(d", -100);     System.out.println(fmt);   } } (100)