| | |
Solve My Question Pls....
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
One way that came to mind is use 2 for-loops
Check out my New Bike at my Public Profile at the "About Me" tab
What about binary calculations 
010
AND
010
is
100

010
AND
010
is
100
Last edited by peter_budo; Nov 29th, 2008 at 7:54 pm.
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
•
•
Join Date: Nov 2008
Posts: 332
Reputation:
Solved Threads: 53
We can multiply/divide by 2 succesive using bitwise operators .
May be You are looking to The Vedas (Sanskrit वेद, véda, "knowledge") arithmetic .The product of the sum - Gunitasamuchyah.
(or Trachtenbergs system to speed multiply in memory).
quuba
byte a = 4;
byte b = (byte) (a >> 1);
byte c = (byte) (a >> 2);
byte d = (byte) (a << 1);
System.out.println(a);
System.out.println(b);
System.out.println(c);
System.out.println(d);(or Trachtenbergs system to speed multiply in memory).
quuba
I m still can't get the answer from u guys.....
Let me explain more in detail:
class add{
public static void main(String args[])
{
int a=2,b=2,c;
c=a+b;
System.out.println("C="+c);
}
}
This what we normally done using arith operator '+'.
I want the answer c=4 without using '+' or any arith operator.
Pls suggest ur ideas through the example.. i m a beginner in java so i can clearly understand... Hoping for u r answers......
Let me explain more in detail:
class add{
public static void main(String args[])
{
int a=2,b=2,c;
c=a+b;
System.out.println("C="+c);
}
}
This what we normally done using arith operator '+'.
I want the answer c=4 without using '+' or any arith operator.
Pls suggest ur ideas through the example.. i m a beginner in java so i can clearly understand... Hoping for u r answers......
•
•
Join Date: Nov 2008
Posts: 332
Reputation:
Solved Threads: 53
c=a+b; - here is arithmetic operator .System.out.println("C="+c); - here is overloaded operator + . Here this mean CONCATENATION of two String-s.
You can asked: c is not a String type. Yes it is true, but c is casting to String automatically before join.
In Your case You can write:
System.out.print("C=");
System.out.println(""+c);// "" (an empty String) can cast integer to StringSystem.out.print("C=");
System.out.println(c);// "" automatic cast int to StringRemark: Sign + in arithmetic has two menings:
1. before a single number indicate, positive number
2. between two numbers , sum operation
Try write:
System.out.println(c++); orSystem.out.println(++c); try explain differencequuba
Use XOR .
![]() |
Similar Threads
- Problem:Could anyone help me here pls. (Java)
- help me on this question, pls (C++)
- help me pls urgent! (C)
- I need help on these questios, pls ? can some one help (C)
- Pls help :Find first non-repeated char in a string (C++)
- structure (C)
- about shopping center (PHP)
- I can't open web link in OE6, please help (Web Browsers)
Other Threads in the Java Forum
- Previous Thread: How to make a Splash Screen
- Next Thread: Help with Dice Simulation
| Thread Tools | Search this Thread |
actuate android api applet application applications array arrays automation balls bank binary bluetooth business chat class classes clear client code codesnippet collections component database defaultmethod development dice dragging ebook eclipse error event exception formatingtextintooltipjava fractal froglogic game givemetehcodez graphics gui hql html ide image infinite input integer intersect invokingapacheantprogrammatically j2me java javaprojects jni jpanel julia linux list loop looping map method methods mobile mysql netbeans newbie numbers openjavafx parameter php print problem program programming project recursion repositories scanner screen scrollbar server set size sms sort sorting sql sqlserver state storm string sun superclass swing swt text-file threads time tree windows






