Click here to Skip to main content
15,923,910 members
Home / Discussions / Java
   

Java

 
QuestionDigital Signature Pin
vivhari3-Sep-09 20:26
vivhari3-Sep-09 20:26 
AnswerRe: Digital Signature Pin
vivhari3-Sep-09 20:56
vivhari3-Sep-09 20:56 
AnswerRe: Digital Signature Pin
Nagy Vilmos3-Sep-09 22:02
professionalNagy Vilmos3-Sep-09 22:02 
GeneralRe: Digital Signature Pin
42774804-Sep-09 10:50
42774804-Sep-09 10:50 
GeneralRe: Digital Signature Pin
42774804-Sep-09 16:46
42774804-Sep-09 16:46 
GeneralRe: Digital Signature Pin
vivhari5-Sep-09 5:34
vivhari5-Sep-09 5:34 
GeneralRe: Digital Signature Pin
42774805-Sep-09 12:42
42774805-Sep-09 12:42 
QuestionFinding Duplicates:(Loop within a Loop) Pin
squalled3-Sep-09 20:20
squalled3-Sep-09 20:20 
public class duplicate {
	int temp, true_count;
	int ar[] = { 1, 2, 3, 4, 1 };
	int count;

	public void find() {
		for (int i = 0; i < ar.length - 1; i++) {
			temp = ar[i];
			for (int j = i; j <= ar.length-1 ; j++) {
				
				if (temp == ar[j]) {

					count += 1;
				}
				
			}
			
			
		}
	}

	public static void main(String args[]) {
		duplicate dup = new duplicate();
		dup.find();

		System.out.println("The No of duplicates is :" + dup.count);

	}

}


This program is supposed to count the no. of duplicates in thearray and print the same. There is something wrong in the loop. PLs tell me what is wrong with the code.
Thanks
AnswerRe: Finding Duplicates:(Loop within a Loop) Pin
Nagy Vilmos3-Sep-09 21:58
professionalNagy Vilmos3-Sep-09 21:58 
AnswerRe: Finding Duplicates:(Loop within a Loop) Pin
TorstenH.4-Sep-09 2:55
TorstenH.4-Sep-09 2:55 
AnswerRe: Finding Duplicates:(Loop within a Loop) Pin
42774804-Sep-09 8:52
42774804-Sep-09 8:52 
QuestionValidation Pin
hitesh.kalra2-Sep-09 2:07
hitesh.kalra2-Sep-09 2:07 
AnswerRe: Validation Pin
42774802-Sep-09 7:11
42774802-Sep-09 7:11 
GeneralRe: Validation Pin
David Skelly2-Sep-09 22:24
David Skelly2-Sep-09 22:24 
GeneralRe: Validation Pin
42774803-Sep-09 1:44
42774803-Sep-09 1:44 
GeneralRe: Validation Pin
David Skelly3-Sep-09 2:39
David Skelly3-Sep-09 2:39 
QuestionRunning Blackberry Application........ Pin
shaina223131-Aug-09 21:41
shaina223131-Aug-09 21:41 
AnswerRe: Running Blackberry Application........ Pin
EliottA2-Sep-09 3:00
EliottA2-Sep-09 3:00 
Questionplease help ... Pin
hitesh.kalra30-Aug-09 23:25
hitesh.kalra30-Aug-09 23:25 
AnswerRe: please help ... Pin
Christian Graus2-Sep-09 14:50
protectorChristian Graus2-Sep-09 14:50 
Questionjava coding Pin
hitesh.kalra30-Aug-09 23:20
hitesh.kalra30-Aug-09 23:20 
AnswerRe: java coding Pin
427748030-Aug-09 23:48
427748030-Aug-09 23:48 
QuestionSVD of image using JAMA.. Pin
ankita0529-Aug-09 20:51
ankita0529-Aug-09 20:51 
AnswerRe: SVD of image using JAMA.. Pin
427748030-Aug-09 12:06
427748030-Aug-09 12:06 
GeneralRe: SVD of image using JAMA.. Pin
ankita0530-Aug-09 15:42
ankita0530-Aug-09 15:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.