<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: java.util.IllegalFormatConversionException when using System.out.format()</title>
	<atom:link href="http://dobrzanski.net/2008/05/02/javautilillegalformatconversionexception-when-using-systemoutformat/feed/" rel="self" type="application/rss+xml" />
	<link>http://dobrzanski.net/2008/05/02/javautilillegalformatconversionexception-when-using-systemoutformat/</link>
	<description>blog for developers</description>
	<lastBuildDate>Thu, 09 Sep 2010 11:58:58 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Raja Nagendra Kumar</title>
		<link>http://dobrzanski.net/2008/05/02/javautilillegalformatconversionexception-when-using-systemoutformat/comment-page-1/#comment-28071</link>
		<dc:creator>Raja Nagendra Kumar</dc:creator>
		<pubDate>Mon, 28 Dec 2009 12:22:22 +0000</pubDate>
		<guid isPermaLink="false">http://dobrzanski.net/?p=85#comment-28071</guid>
		<description>As a addendum to the same error, we see the following can happen due to lack of conversion from long to float.

for a code like this

boolean lInMBSize = (sizeCount / CommonConst.MEGA_BYTES) &gt; 0;
	StringBuffer sb = new StringBuffer();
	Formatter fm = new Formatter(sb);
	fm.format(&quot;\n%-16s\t%-6d\t%15.2f %s\t%-16d&quot;,
		  ext,
		  fileCount,
		  lInMBSize ?
		  (sizeCount / CommonConst.MEGA_BYTES) :
		  (sizeCount / CommonConst.KB_BYTES),
		  lInMBSize ? &quot;MB&quot; : &quot;kb&quot;,
		  lineCount);
	return sb.toString();

We are seeing similar error in this case for converting long to float..the value of long passed is 2..

Hope long to be convertible to float as they are compatible.


java.util.IllegalFormatConversionException: f != java.lang.Long
        at java.util.Formatter$FormatSpecifier.failConversion(Formatter.java:399
9)
        at java.util.Formatter$FormatSpecifier.printFloat(Formatter.java:2722)
        at java.util.Formatter$FormatSpecifier.print(Formatter.java:2667)
        at java.util.Formatter.format(Formatter.java:2433)
        at java.util.Formatter.format(Formatter.java:2367)
        at com.tejasoft.ant.common.cm.CMInfo.toString(CMInfo.java:99)
        at java.lang.String.valueOf(String.java:2826)</description>
		<content:encoded><![CDATA[<p>As a addendum to the same error, we see the following can happen due to lack of conversion from long to float.</p>
<p>for a code like this</p>
<p>boolean lInMBSize = (sizeCount / CommonConst.MEGA_BYTES) &gt; 0;<br />
	StringBuffer sb = new StringBuffer();<br />
	Formatter fm = new Formatter(sb);<br />
	fm.format(&#8220;\n%-16s\t%-6d\t%15.2f %s\t%-16d&#8221;,<br />
		  ext,<br />
		  fileCount,<br />
		  lInMBSize ?<br />
		  (sizeCount / CommonConst.MEGA_BYTES) :<br />
		  (sizeCount / CommonConst.KB_BYTES),<br />
		  lInMBSize ? &#8220;MB&#8221; : &#8220;kb&#8221;,<br />
		  lineCount);<br />
	return sb.toString();</p>
<p>We are seeing similar error in this case for converting long to float..the value of long passed is 2..</p>
<p>Hope long to be convertible to float as they are compatible.</p>
<p>java.util.IllegalFormatConversionException: f != java.lang.Long<br />
        at java.util.Formatter$FormatSpecifier.failConversion(Formatter.java:399<br />
9)<br />
        at java.util.Formatter$FormatSpecifier.printFloat(Formatter.java:2722)<br />
        at java.util.Formatter$FormatSpecifier.print(Formatter.java:2667)<br />
        at java.util.Formatter.format(Formatter.java:2433)<br />
        at java.util.Formatter.format(Formatter.java:2367)<br />
        at com.tejasoft.ant.common.cm.CMInfo.toString(CMInfo.java:99)<br />
        at java.lang.String.valueOf(String.java:2826)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tahir</title>
		<link>http://dobrzanski.net/2008/05/02/javautilillegalformatconversionexception-when-using-systemoutformat/comment-page-1/#comment-27895</link>
		<dc:creator>Tahir</dc:creator>
		<pubDate>Thu, 24 Dec 2009 10:10:01 +0000</pubDate>
		<guid isPermaLink="false">http://dobrzanski.net/?p=85#comment-27895</guid>
		<description>Thanks, It is much clear and to the point.
Precise and concise without any unnecessary stuff</description>
		<content:encoded><![CDATA[<p>Thanks, It is much clear and to the point.<br />
Precise and concise without any unnecessary stuff</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: deval mathur</title>
		<link>http://dobrzanski.net/2008/05/02/javautilillegalformatconversionexception-when-using-systemoutformat/comment-page-1/#comment-11289</link>
		<dc:creator>deval mathur</dc:creator>
		<pubDate>Mon, 17 Nov 2008 06:46:33 +0000</pubDate>
		<guid isPermaLink="false">http://dobrzanski.net/?p=85#comment-11289</guid>
		<description>it was helpful....
i was struck at it at one point....gud</description>
		<content:encoded><![CDATA[<p>it was helpful&#8230;.<br />
i was struck at it at one point&#8230;.gud</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff</title>
		<link>http://dobrzanski.net/2008/05/02/javautilillegalformatconversionexception-when-using-systemoutformat/comment-page-1/#comment-5694</link>
		<dc:creator>Jeff</dc:creator>
		<pubDate>Fri, 13 Jun 2008 00:44:01 +0000</pubDate>
		<guid isPermaLink="false">http://dobrzanski.net/?p=85#comment-5694</guid>
		<description>Thanks soooooooooooo much Jarosław for this very helpful help.</description>
		<content:encoded><![CDATA[<p>Thanks soooooooooooo much Jarosław for this very helpful help.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
