30 import java.text.NumberFormat; 31 import java.util.concurrent.atomic.AtomicInteger; 32 import java.util.concurrent.atomic.AtomicLong; 33 34 import java.util.Locale; 35 36 public class Bug6278616 { 37 38 static final int[] ints = { 39 Integer.MIN_VALUE, -1, 0, 1, Integer.MAX_VALUE 40 }; 41 42 static final long[] longs = { 43 Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE 44 }; 45 46 public static void main(String[] args) { 47 NumberFormat nf = NumberFormat.getInstance(); 48 49 for (int j = 0; j < ints.length; j++) { 50 String s_i = nf.format(new Integer(ints[j])); 51 String s_ai = nf.format(new AtomicInteger(ints[j])); 52 if (!s_i.equals(s_ai)) { 53 throw new RuntimeException("format(AtomicInteger " + s_ai + 54 ") doesn't equal format(Integer " + 55 s_i + ")"); 56 } 57 } 58 59 for (int j = 0; j < longs.length; j++) { 60 String s_l = nf.format(new Long(longs[j])); 61 String s_al = nf.format(new AtomicLong(longs[j])); 62 if (!s_l.equals(s_al)) { 63 throw new RuntimeException("format(AtomicLong " + s_al + 64 ") doesn't equal format(Long " + 65 s_l + ")"); 66 } 67 } 68 } 69 } | 30 import java.text.NumberFormat; 31 import java.util.concurrent.atomic.AtomicInteger; 32 import java.util.concurrent.atomic.AtomicLong; 33 34 import java.util.Locale; 35 36 public class Bug6278616 { 37 38 static final int[] ints = { 39 Integer.MIN_VALUE, -1, 0, 1, Integer.MAX_VALUE 40 }; 41 42 static final long[] longs = { 43 Long.MIN_VALUE, -1, 0, 1, Long.MAX_VALUE 44 }; 45 46 public static void main(String[] args) { 47 NumberFormat nf = NumberFormat.getInstance(); 48 49 for (int j = 0; j < ints.length; j++) { 50 String s_i = nf.format(ints[j]); 51 String s_ai = nf.format(new AtomicInteger(ints[j])); 52 if (!s_i.equals(s_ai)) { 53 throw new RuntimeException("format(AtomicInteger " + s_ai + 54 ") doesn't equal format(Integer " + 55 s_i + ")"); 56 } 57 } 58 59 for (int j = 0; j < longs.length; j++) { 60 String s_l = nf.format(longs[j]); 61 String s_al = nf.format(new AtomicLong(longs[j])); 62 if (!s_l.equals(s_al)) { 63 throw new RuntimeException("format(AtomicLong " + s_al + 64 ") doesn't equal format(Long " + 65 s_l + ")"); 66 } 67 } 68 } 69 } |