Results 1 to 6 of 6
Thread: equation
 09062010, 06:23 AM #1Member
 Join Date
 Sep 2010
 Posts
 37
 Rep Power
 0
 09062010, 07:42 AM #2
Take firstly into consideration that the symbol for modulus (mod) is a percent sign (%). Secondly, remember that in Java [] is used for array features. You will have to use layered ()s. That is to say:
Java Code:int x = [7 + 5 * (6 + 2)] * 7; // Invalid. int y = {7 + 5 * (6 + 2)} * 7; // Invalid. int z = (7 + 5 * (6 + 2)) * 7; // VALID.
 09062010, 07:50 AM #3Member
 Join Date
 Sep 2010
 Posts
 37
 Rep Power
 0
I wrote a function for RSA encryption, which calculate b^e mod n. As you know e is public exponent and n is module.
but I have an equation that a public key multiply b^e.
I don't know how to implement this.
regards,
 09062010, 11:07 AM #4
for b^e you can use this example
Java Code:double b = 3.0; double e = Math.E; System.out.println(Math.pow(b, e));
and i assume module is the modulo in java, so use the % as modulo. in the following example the modulo of 6.5 mod 3.0 is calculated
Java Code:double d1 = 6.5; double d2 = 3.0; System.out.println(d1 % d2);
and the output is 0.5.
 09062010, 12:29 PM #5
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 13,525
 Blog Entries
 7
 Rep Power
 20
Don't use the Math.pow( ... ) method; have a look at the BigInteger class, it implements the modPow( ... ) method and much more efficient than a general pow( ... ) method can do.
kind regards,
Jos
 09062010, 06:40 PM #6Member
 Join Date
 Sep 2010
 Posts
 37
 Rep Power
 0
Similar Threads

Need help with math equation
By annabellastorm in forum New To JavaReplies: 4Last Post: 01102010, 05:12 PM 
differential equation RK4
By arvindmer in forum New To JavaReplies: 3Last Post: 01082009, 01:27 PM 
Quadratic Equation
By jpnym15 in forum New To JavaReplies: 4Last Post: 11122008, 03:29 AM 
Help with an equation in java
By coco in forum New To JavaReplies: 1Last Post: 07312007, 07:47 AM 
Problem with equation in my algorithm
By romina in forum New To JavaReplies: 2Last Post: 07202007, 07:53 AM
Bookmarks