Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Daniele Futtorovic Newsgroups: comp.lang.java.programmer Subject: Re: boolean to int : was char to decimal Date: Fri, 06 May 2011 19:12:48 +0200 Organization: A noiseless patient Spider Lines: 24 Message-ID: References: <92ea64F3avU1@mid.individual.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 6 May 2011 17:12:48 +0000 (UTC) Injection-Info: mx01.eternal-september.org; posting-host="Zjm1/7nnVMUmB9baN8E6xQ"; logging-data="20968"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/tUNw0wOk6Y60jMpHzBUXQ" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 In-Reply-To: Cancel-Lock: sha1:2SQXYcoCoUFW2IImG9AxxTypGmU= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:3701 On 06/05/2011 15:00, Jeff Higgins allegedly wrote: > Recently I was translating a piece of C++ code to Java. > I'm wondering how others might make this translation. > Thanks, JSH. > > double d2; > double d3; > double e; > > C++ test: > int test = (int(d2 > e) << 1) + int(d3 > e); Java test: int gt( int t1, int i2 ) { return i1 > i2 ? 1 : 0 } void test() { int test = (gt(d2, e) << 1) + gt(d3, e); } -- DF. An escaped convict once said to me: "Alcatraz is the place to be"