Posts
 
Reputation
Joined
Last Seen
Ranked #626
Strength to Increase Rep
+4
Strength to Decrease Rep
-1
86% Quality Score
Upvotes Received
6
Posts with Upvotes
6
Upvoting Members
6
Downvotes Received
1
Posts with Downvotes
1
Downvoting Members
1
3 Commented Posts
0 Endorsements
Ranked #864
~19.2K People Reached
Favorite Tags
Member Avatar for daudiam
Member Avatar for venkat arun

Arrays/Objects ARE accessed using reference variables. Parameters are passed by value in Java, so if you pass an array to a method it is a copy of the reference to the Object or array that is passed not a whole copy of each element in the array. It goes to …

Member Avatar for sbp94
0
162
Member Avatar for badnack

I assume you are using self signed certificates. Is your friend using a proper signed certificate?

Member Avatar for badnack
0
238
Member Avatar for gourav1
Member Avatar for rutwvu

Looks like you are learning the hard way parallel programming. MPI has all the tools to do this relatively painlessly. Doing it the hard way I guess: create original array containing all the data and two other arrays half the size, create your two sub processes, each subprocess sorts one …

Member Avatar for rutwvu
0
1K
Member Avatar for subone

well known method: (( 1stNumber + 2ndNumber ) * numberOfNumbers) / 2 eg. 1st Number = 4 2nd = number 8 ( ( 4 + 8 ) * ( 8 - 4 + 1 ) ) / 2 ( 12 * 5 ) / 2 = 30

Member Avatar for aspire1
0
302
Member Avatar for Santosh gupta

The default .hashCode() method uses the contents of the string to create the hashcode so unsuprisingly all the values are the same. A better test is: [code] String str1="ABC"; String str2="ABC"; String str3 = new String("ABC"); if( str1 == str2 ) System.out.println( "str1 and str2 reference same object"); else System.out.println( …

Member Avatar for Santosh gupta
0
101
Member Avatar for laguardian

Just out of interest, here is a recursive method ( which I don't claim to have rigorously tested by any means) [CODE] public static int sumPowers( int n, int m ) { if( m > 0 ) { int sum = n; sum *= sumPowers( n, --m ); return sum+1; …

Member Avatar for Slimmy
0
2K
Member Avatar for by_stander

...as has been pointed out double is different from Double, double is a primitive type, Double is an immutable object, arraylists and other such collections can only accept objects. If using an array is appropriate for the situation then go ahead and use it, if a dynamic data structure such …

Member Avatar for by_stander
0
6K
Member Avatar for ComicStix

Big problem I've seen at universities/colleges compared to back then is students expecting the "teaching" of a subject to be only within the bounds of what is actually delivered within class rather than what is delivered in class being a basis for reasearching and learning on your own. My opinion …

Member Avatar for rscubelek
0
224
Member Avatar for Neversleepin

You have a text file. It is split into lines. You are reading it a line at a time. Read a line and if it starts with S and 2 then ignore it. String.startswith() or something like that. Lookup String class.

Member Avatar for Neversleepin
0
2K
Member Avatar for gooradog

a) 2 power 24 - 1 b) well BCD 4 bits each digit 0-9, work it out, 21 - 0010 0001 c) a bit of a trick question, ACII is used to represent characters not numbers specifically but you can look up the ASCII table and fiddle about but I'd …

Member Avatar for aspire1
0
80
Member Avatar for gooradog

Taking what you've said without any further constraints then interpret it as a poistive base two number, convert it to decimal and that is that.

Member Avatar for aspire1
0
54
Member Avatar for VernonDozier

Yup local variable is getting created. You're not actually modifying anything - java everything is passed by value, a copy is made. So a copy of whatever reference value bytes[] holds is getting made, in this case null and assigned to the local variable bytes in your function. You have …

Member Avatar for VernonDozier
0
214
Member Avatar for plasticfood

[code]if(numList.get(i) == numList.get(j))[/code] You are actually comparing if two Integer objects are referencing the same object. Try numList.get(i).intValue() == numList.get(j).intValue() Couldn't say for sure why the way you are doing it works in some cases.

Member Avatar for plasticfood
0
103
Member Avatar for andyhunter

You have to provide a lower aswell as an upper bound or your expression will return true at the first match e.g //Sanitize salesPersonName first salesPersonName.matches( "[a-zA-Z]{20,20}"); As a tip, it's redundant to be doing the test twice in your code, use a normal while loop rather than do/while.

Member Avatar for aspire1
0
89
Member Avatar for softswing
Member Avatar for ankit.jivrani
0
104
Member Avatar for Sunshineserene

Just use one pass of the bubble sort algorithm as hinted at in the code in previous post. The larget value in the array will be in the last position of the array after one pass, the second largest in second last position after two passes etc..

Member Avatar for Sunshineserene
0
310
Member Avatar for NotThereAnymore

And another variation where index is initially the length of the String: [code] public String reverse(String s, int index ){ if( index >0 ) { return s.charAt( --index) + reverse( s, index); } return ""; } [/code]

Member Avatar for aspire1
0
584
Member Avatar for stevebush

Simple answer - sort your small list using an appropriate algorithm then merge them using an appropriate algorithm and of course you can sort a linked list in less than O(n^2).

Member Avatar for AuburnMathTutor
0
108
Member Avatar for JTroopSoldier

Just my penny's worth - do it if you are genuinely interested in it. Computer Science isn't "all my friends have problems with windows and I fix it for them". Programming is only one area of Computer Science ( all be it important ) and even then, knowing the syntax …

Member Avatar for smokewire
0
217
Member Avatar for iamcreasy

[QUOTE]Isn't 10 instances of Animal class is being created with this line?[/QUOTE] Nope, ten uninitialized reference variables of type Animal are being created.

Member Avatar for NormR1
0
97
Member Avatar for ttboy04

Just out of curiosity, what is the overall aim of the program? Are you trying to generate the power set of an array of values and do you have to use Random? At what point will the program have accomplished it's mission?

Member Avatar for aspire1
0
136
Member Avatar for tennis
Member Avatar for mitch9654

As far as I'm aware applets can't by default write to the local file system: security. Google should show you how to do it.

Member Avatar for mitch9654
0
137
Member Avatar for insanely_sane

This is one version. You might want to look up Generics as of course, only works with int[] [CODE] private static void mergeSort( int[] data ) { if( data.length > 1 ) { int midPoint = data.length / 2; int[] left = new int[ midPoint ]; int[] right = new …

Member Avatar for insanely_sane
0
204
Member Avatar for tam13
Member Avatar for aspire1
0
104
Member Avatar for ChPravin

I assume it means shifting all the elements one place to the right with the last element in the array wrapping around to be the first element in the array with every rotation.

Member Avatar for ChPravin
0
132
Member Avatar for DrApe1

You had the hostname spelling wrong for one thing and your use of Scanner doesn't look right. You program still isn't quite right though. Remember, it's possible to telnet into servers that use "text" format which can help a lot in trouble shooting. [CODE] Socket s = new Socket("time-a.nist.gov", HTTP_PORT); …

Member Avatar for aspire1
0
127
Member Avatar for xenanovich