Searched refs:format (Results 1 - 25 of 87) sorted by relevance

1234

/libcore/luni/src/test/java/libcore/java/text/
H A DOldDecimalFormatTestICU.java32 DecimalFormat format; field in class:OldDecimalFormatTestICU
35 format = (DecimalFormat) NumberFormat.getNumberInstance();
40 DecimalFormat format = (DecimalFormat) NumberFormat
43 format.applyPattern("@@@");
44 assertEquals("sigDigit doesn't work", "12300", format.format(12345));
45 assertEquals("sigDigit doesn't work", "0.123", format.format(0.12345));
47 format.applyPattern("@@##");
48 assertEquals("sigDigit doesn't work", "3.142", format
[all...]
H A DOldDecimalFormatTest.java163 DecimalFormat format = new DecimalFormat();
165 format.isParseIntegerOnly());
167 format.setParseIntegerOnly(true);
168 assertTrue(format.isParseIntegerOnly());
170 Number result = format.parse("123.123");
176 format.setParseIntegerOnly(false);
177 assertFalse(format.isParseIntegerOnly());
179 Number result = format.parse("123.123");
192 DecimalFormat format = new DecimalFormat(pattern);
193 assertFalse(format
600 compare(String testName, String format, String expected) argument
605 compare(int count, String format, String expected) argument
[all...]
H A DOldNumberFormatTest.java34 DecimalFormat format = (DecimalFormat) NumberFormat.getIntegerInstance(Locale.US);
35 assertEquals("#,##0", format.toPattern());
36 assertEquals("-36", format.format(-35.76));
37 assertEquals(new Long(-36), format.parse("-36"));
38 assertEquals(new Long(-36), format.parseObject("-36"));
39 assertEquals(0, format.getMaximumFractionDigits());
40 assertTrue(format.isParseIntegerOnly());
45 format = (DecimalFormat) NumberFormat.getIntegerInstance(chLocale);
46 assertEquals("#,##0", format
828 public StringBuffer format(double number, StringBuffer toAppendTo, method in class:OldNumberFormatTest.MyNumberFormat
839 public StringBuffer format(long number, StringBuffer toAppendTo, method in class:OldNumberFormatTest.MyNumberFormat
[all...]
H A DDecimalFormatTest.java31 assertEquals("1E4", df.format(12345.));
36 assertEquals("1-useless-api-4", df.format(12345.));
43 assertEquals("-0", df.format(-0.2));
45 assertEquals("-0.2", df.format(-0.2));
56 assertEquals(309, numberFormat.format(123).length());
57 assertEquals(309, numberFormat.format(BigInteger.valueOf(123)).length());
64 assertEquals("17%", pf.format(BigDecimal.valueOf(0.17)));
128 assertEquals(df.format(BigDecimal.valueOf(0.16)),
129 df.format(BigDecimal.valueOf(0.16).doubleValue()));
130 assertEquals(df.format(BigDecima
[all...]
H A DSimpleDateFormatTest.java81 SimpleDateFormat format = new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy", Locale.US);
82 format.setTimeZone(TimeZone.getTimeZone("UTC"));
85 format.format(new Date(((long) Integer.MIN_VALUE + Integer.MIN_VALUE) * 1000L)));
87 format.format(new Date(Integer.MIN_VALUE * 1000L)));
89 format.format(new Date(0L)));
91 format.format(ne
[all...]
H A DNumberFormatTest.java29 // NumberFormat.format(Object, StringBuffer, FieldPosition) guarantees it calls doubleValue for
42 assertEquals("123", nf.format(new MyNumber()));
45 // NumberFormat.format(Object, StringBuffer, FieldPosition) guarantees it calls longValue for
49 public StringBuffer format(double value, StringBuffer b, FieldPosition f) {
53 public StringBuffer format(long value, StringBuffer b, FieldPosition f) {
62 assertEquals("long", nf.format(BigInteger.valueOf(Long.MAX_VALUE)));
63 assertEquals("double", nf.format(BigInteger.valueOf(Long.MAX_VALUE).add(BigInteger.ONE)));
64 assertEquals("long", nf.format(BigInteger.valueOf(Long.MIN_VALUE)));
65 assertEquals("double", nf.format(BigInteger.valueOf(Long.MIN_VALUE).subtract(BigInteger.ONE)));
86 nf.format(123456789
[all...]
H A DOldDateFormatTest.java46 public StringBuffer format(Date date, StringBuffer toAppendTo, method in class:OldDateFormatTest.MockDateFormat
71 DateFormat format = DateFormat.getInstance();
72 DateFormat clone = (DateFormat) format.clone();
73 assertTrue("Clone and parent are not equaled", format.equals(clone));
76 format.setCalendar(Calendar.getInstance());
77 assertTrue("Clone and parent are not equaled", format.equals(clone));
84 * java.text.DateFormat#format(java.util.Date) Test of method
85 * java.text.DateFormat#format(java.util.Date).
89 DateFormat format = DateFormat.getDateTimeInstance(
92 String dtf = format
[all...]
H A DOldMessageFormatTest.java48 MessageFormat format = new MessageFormat("test");
49 format.setLocale(Locale.FRENCH); // use French since English has the
51 format.applyPattern("{0,time, Full}");
52 assertEquals("Wrong full time pattern", "{0,time,full}", format
143 "Test1B:wrong format for pattern index " + i + ":",
164 // java.text.MessageFormat.format(java.lang.Object [],
166 MessageFormat format = new MessageFormat("{1,number,integer}");
168 format.format(new Object[] { "0", new Double(53.863) }, buffer,
172 format
[all...]
/libcore/luni/src/test/java/libcore/java/util/
H A DFormatterTest.java33 String.format(arabic, "12 %d 34", 1234567890));
36 String.format(arabic, "12 %,d 34", 1234567890));
39 String.format(arabic, "12 %.3e 34", 1.23));
41 String.format(arabic, "12 %.3f 34", 1.23));
43 String.format(arabic, "12 %.3g 34", 1.23));
49 String.format(arabic, "12 %tT 34", c));
51 assertEquals("1234", String.format(arabic, "1234"));
52 assertEquals("1234", String.format(arabic, "%s", "1234"));
53 assertEquals("1234", String.format(arabic, "%s", 1234));
54 assertEquals("2322", String.format(arabi
[all...]
H A DOldFormatterTest.java51 assertEquals("aaa 111?", new Formatter().format("aaa %s?", ones).toString());
52 assertEquals("aaa 111 bbb 222?", new Formatter().format("aaa %s bbb %s?", ones, twos).toString());
65 fLoc.format(Locale.US, "%f", val);
66 fNoL.format("%f", val);
73 fLoc.format(Locale.US, "%f", val);
74 fNoL.format("%f", val);
80 fLoc.format(Locale.US, "%f", val);
81 fNoL.format("%f", val);
87 fLoc.format(Locale.US, "%tA %tB %td %tT", cal, cal, cal, cal);
88 fNoL.format("
[all...]
H A DOldFormattableTest.java39 arg0.format(sb.toString());
52 assertTrue(fmt.format("%1.1s", mf).toString().equals("single precision "));
53 assertTrue(fmt.format("%2.1s", mf).toString().equals("single precision single precision "));
54 assertTrue(fmt.format("%2.2s", mf).toString().equals("single precision single precision double precision "));
/libcore/support/src/test/java/org/apache/harmony/security/tests/support/
H A DPrivateKeyStub.java36 String format = null; field in class:PrivateKeyStub
44 * @param format
47 public PrivateKeyStub(String algorithm, String format, byte[] encoded) { argument
49 this.format = format;
62 * Returns format
66 return format;
H A DPublicKeyStub.java39 String format = null; field in class:PublicKeyStub
45 public PublicKeyStub(String algorithm, String format, byte[] encoded) { argument
47 this.format = format;
59 * returns format
63 return format;
H A DCertificateStub.java39 String format; field in class:CertificateStub
44 public CertificateStub(String format, Principal guarantor, Principal principal, PublicKey key){ argument
45 this.format = format;
76 return format;
H A DMyKeyPairGenerator1.java97 private String format; field in class:MyKeyPairGenerator1.PubKey
103 this.format = "test1";
112 return format;
123 private String format; field in class:MyKeyPairGenerator1.PrivKey
129 this.format = "test1";
138 return format;
/libcore/luni/src/main/java/java/security/
H A DKeyRep.java41 // Key encoding format
42 private final String format; field in class:KeyRep
55 * @param format
56 * the format of the key (obtained by {@link Key#getFormat()}).
61 * if {@code type, algorithm, format or encoded} is {@code null}
64 public KeyRep(Type type, String algorithm, String format, byte[] encoded) { argument
67 this.format = format;
75 if(this.format == null) {
76 throw new NullPointerException("format
[all...]
H A DAlgorithmParametersSpi.java48 * {@code byte[]} using the default decoding format for parameters. The
49 * default encoding format is ASN.1.
61 * {@code byte[]} using the specified decoding format.
65 * @param format
66 * the name of the decoding format.
71 protected abstract void engineInit(byte[] params, String format) argument
92 * Returns the parameters in their default encoding format. The default
93 * encoding format is ASN.1.
103 * Returns the parameters in the specified encoding format.
105 * @param format
112 engineGetEncoded(String format) argument
[all...]
/libcore/luni/src/main/java/java/io/
H A DConsole.java67 * the specified format string and arguments.
69 * @param format the format string (see {@link java.util.Formatter#format})
72 * more arguments than required by {@code format},
76 public Console format(String format, Object... args) { argument
78 f.format(format, args);
84 * Equivalent to {@code format(forma
86 printf(String format, Object... args) argument
124 readLine(String format, Object... args) argument
169 readPassword(String format, Object... args) argument
[all...]
H A DPrintStream.java29 * writing common data types in a human readable format. This is not to be
267 * Formats {@code args} according to the format string {@code format}, and writes the result
271 * @param format the format string (see {@link java.util.Formatter#format})
274 * more arguments than required by {@code format},
278 * if the format string is illegal or incompatible with the
280 * error regarding the format string or arguments is detected.
281 * @throws NullPointerException if {@code format
283 format(String format, Object... args) argument
306 format(Locale l, String format, Object... args) argument
333 printf(String format, Object... args) argument
356 printf(Locale l, String format, Object... args) argument
[all...]
H A DPrintWriter.java27 * readable format. No {@code IOException} is thrown by this class. Instead,
264 * Formats {@code args} according to the format string {@code format}, and writes the result
269 * @param format the format string (see {@link java.util.Formatter#format})
272 * more arguments than required by {@code format},
276 * if the format string is illegal or incompatible with the
278 * error regarding the format string or arguments is detected.
279 * @throws NullPointerException if {@code format
281 format(String format, Object... args) argument
305 format(Locale l, String format, Object... args) argument
335 printf(String format, Object... args) argument
358 printf(Locale l, String format, Object... args) argument
[all...]
/libcore/luni/src/main/java/org/apache/harmony/security/x501/
H A DName.java104 * the format requested
106 * @param format one of X500Principal.CANONICAL, X500Principal.RFC1779, or
109 public String getName(String format) { argument
113 if (X500Principal.RFC1779.equals(format)) {
116 rfc1779String = getName0(format);
120 } else if (X500Principal.RFC2253.equals(format)) {
123 rfc2253String = getName0(format);
127 } else if (X500Principal.CANONICAL.equals(format)) {
130 canonicalString = getName0(format);
138 else if (X500Principal.RFC1779.equalsIgnoreCase(format)) {
168 getName0(String format) argument
[all...]
/libcore/luni/src/main/java/java/text/
H A DMessageFormat.java101 * produce a number format with the hash-sign quoted, with a result such as:
109 * <dd>The rules for using quotes within message format patterns unfortunately
125 * {@code arguments} array passed to the {@code format} methods or
129 * {@code Format} instance for the format element. The following table
230 * String result = MessageFormat.format(
241 * Typically, the message format will come from resources, and the
249 * System.out.println(form.format(testArgs));
272 * System.out.println(form.format(testArgs));
296 * patterns), then be careful not to produce a format that recurses on itself,
305 * String result = mf.format(obj
548 public final StringBuffer format(Object[] objects, StringBuffer buffer, method in class:MessageFormat
651 handleFormat(Format format, Object arg, int begin, List<FieldContainer> fields) argument
700 public final StringBuffer format(Object object, StringBuffer buffer, method in class:MessageFormat
717 format(String format, Object... args) argument
761 setFormatByArgumentIndex(int argIndex, Format format) argument
1040 setFormat(int offset, Format format) argument
1092 decodeDecimalFormat(StringBuffer buffer, Format format) argument
1109 decodeSimpleDateFormat(StringBuffer buffer, Format format) argument
[all...]
/libcore/support/src/test/java/libcore/java/io/
H A DNullPrintStream.java36 public PrintStream format(String format, Object... args) { return this; } argument
37 public PrintStream format(Locale l, String format, Object... args) { return this; } argument
38 public PrintStream printf(String format, Object... args) { return this; } argument
39 public PrintStream printf(Locale l, String format, Object... args) { return this; } argument
/libcore/support/src/test/java/tests/support/
H A DSupport_DecimalFormat.java42 DecimalFormat format = (DecimalFormat) NumberFormat
47 t_FormatWithField(0, format, number, text, NumberFormat.Field.CURRENCY,
49 t_FormatWithField(1, format, number, text, NumberFormat.Field.INTEGER,
51 t_FormatWithField(2, format, number, text,
53 t_FormatWithField(3, format, number, text,
55 t_FormatWithField(4, format, number, text, NumberFormat.Field.FRACTION,
59 t_FormatWithField(5, format, number, text, NumberFormat.Field.SIGN, 0,
61 t_FormatWithField(6, format, number, text, NumberFormat.Field.EXPONENT,
63 t_FormatWithField(7, format, number, text,
65 t_FormatWithField(8, format, numbe
[all...]
/libcore/luni/src/test/java/libcore/javax/security/auth/x500/
H A DX500PrincipalTest.java54 * Confirm DRLCertFactory uses a non-hex format for T61String encoding: http://b/2102191
78 for (String format : formats) {
79 assertEquals(certBC.getSubjectX500Principal().getName(format),
80 certDRL.getSubjectX500Principal().getName(format));
81 assertEquals(certBC.getIssuerX500Principal().getName(format),
82 certDRL.getIssuerX500Principal().getName(format));

Completed in 347 milliseconds

1234