Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Spring Framework | Web Services | BioInformatics | Java Server Faces | Jboss 3.0 tutorial | Hibernate 3.0 | XML
 
 
Hot Web Programming Job

 

Tutorial Categories: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML


 

Java Tutorials

Core Java
JSP
Servlet
JDBC
Hibernate
Struts 1
Struts 2
JSF
Spring
J2EE
J2ME
Web Services
Ajax
Dojo
MySQL
Latest Comments
Null pointer excep
swap program faile
hi.........
very good
navigaton mobile
  All Comments...
 

 

 
Struts Tutorials
*Stuts TOC
*Apache Struts Introduction
* Struts Controller
* Struts Action Class
* Struts ActionFrom Class
* Using Struts HTML Tags
*Struts Validator Framework    
*Client Side Address Validation    
*Struts Tiles
*tiles-defs.xml
*Struts DynaActionForm
*Struts File Upload
*Struts DataSource
*AGGREGATING ACTIONS
*Internationalization
Struts Resources
*Struts Books
*Struts Articles
*Struts Frameworks
*Struts IDE
*Struts Alternative
*Struts Links
*Struts Presentations
*Struts Projects
*Struts Software
*Struts Reference
*Struts Resources
*Other Struts Tutorial
Visit Forum! Post Questions!
Jobs At RoseIndia.net!

Have tutorials?
Add your tutorial to our Java Resource and get tons of hits.

We offer free hosting for your tutorials. and exposure for thousands of readers. drop a mail
roseindia_net@yahoo.com
 
   

 
Join For Newsletter

Powered by groups.yahoo.com
Visit Group! Post Questions!

Java Beginners Prime_number

User Comments
Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl
  Blink   Furl   Simpy   Y! MyWeb 

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

7 comments so far (post your own) View All Comments Latest 10 Comments:

can any one help me to give a program in micro controller for checking whether a given number is prime or not ,,,,,,,,,,,,,urgent

Posted by jerin on Friday, 10.3.08 @ 20:58pm | #80877

I have this Prime Checking Java coding problem:

A prime number ‘p’ is a positive integer (p>1) that can only be divided evenly by:
a) ‘p’ Itself (so the result of the division is: p/p = 1)
b) 1 (so the result of the division is p/1 = p)

The first few prime numbers are:

2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31

Write a Class PrimeChecker that has checkPrime() method as follows:

public class PrimeChecker {

public static boolean checkPrime(int anyNumber){

// write your logic here
}

public static void main(String[] args) {
boolean found = false;
for (int p=-5; p<35;p++){
found = checkPrime(p);
if (found){
System.out.print(p + "\t");
}
}
}
}

Obviously, the method checkPrime will take in any integer and return true of false depending on whether integer is Prime or not.

As a tester for your code, the main method is sending a series of integers to the checkPrime method.

Here is the expected output:

2 3 5 7 11 13 17 19 23 29 31

Thanks.

Posted by Cris on Monday, 03.10.08 @ 04:58am | #52148

thanks for ur help

Posted by paddu on Thursday, 09.20.07 @ 19:04pm | #28204

This is a very simple implementation of a prime number check. I feel checking every single divisor of a number to verify its primality is sort of 'brute force' is there a more elegant way to do this?

Posted by Saleem on Thursday, 05.10.07 @ 15:08pm | #15568

how to develop java progrmas logic

Posted by saikrishna on Sunday, 03.25.07 @ 16:35pm | #12661

i found very interesting and easy to understood your explanations and i think you're doing a terrific job.

as all of beginners, i need a little help from u:
what if i have more numbers i have to find the prime one, how can write the code?

thank u for your time and best regards
PDE

ps- hope u have time for my question

Posted by PDE on Thursday, 01.11.07 @ 05:45am | #3169

wow! this is really cool. an easy program that is. can you tell me what the % do? does this really compute all prime numbers including above million? becuase I tried to input more than a million and it always come out to be "not prime," I'm just not sure if it's really accurate. is it?

do you have a program for a simple calculator that computes 3 operations, as for example 89+34*6 - in this case, it follows the math rule which executes the multiplication first then addition?

well, i just need a little help in starting my project. and i hope you would be able to read this and consider my request.

thanx.

Posted by Markhooz on Monday, 12.11.06 @ 08:19am | #745

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Back to Tutorial

 

  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification

Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2007. All rights reserved.