Ernie Mcracken

Ranch Hand
+ Follow
since Feb 13, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Ernie Mcracken

Surely you need to initiliaze your left and right ints, or your direction will never equal them, and you probably want to use the logical or operator || instead of &&.
13 years ago
That seems to work nicely, thanks very much. I did notice that you can do it with BigInteger but that would be a pain to implement in my code.

Thanks again.
13 years ago
Hi,

Doe's anyone know how to do modular arithmetic in Java ? I need to do modular subtraction so using the % operator is out of the window.

Cheers

Ernie
13 years ago
Hi,

You've got a few problems with it...

This will give you a compile time error because you haven't opened the curly brace for the else.


This will give you an array index out of bounds exception at runtime because you are trying to put something into an element of an array that doesn't exist.





13 years ago
Ah sorry I meant that to say use ListIterator,



Output is

Yo
Hi
13 years ago
The strings in your set will be sorted alphabetically so if you want to take into account the AM / PM you would need to use something other than String or have a class that implements comparable and overides compareTo() to take it into account i think.
13 years ago
I would probably be inclined to get the iterator for your list and use that.
13 years ago
When i compile and run your code I get a 180k file that is all printable text.


<meta name="description" content="Welcome to Yahoo!, the world's most visited home page. Quickly find what you're searching for, get in touch with friends and stay in-the-know with the latest news and information.">
<meta name="keywords" content="yahoo, yahoo uk, yahoo home page, yahoo homepage,yahoo search, yahoo mail, yahoo messenger, news, finance, sport, entertainment,games">



Im guess your problem is probably a charset issue. How are you viewing the contents.txt file?
13 years ago
Hey,

Strings aren't really primitive types although it's easy to think of them that way, so because they are objects they live on the heap as far as I am aware.

13 years ago
If you know all the possible states of what you are describing in your code when you compile it then you should use enumerated types. Simples.
13 years ago
tty should give you a unique for every value instance of a login to a shell regardless of it the UID is the same (i think).
13 years ago
Are you sure $BASHPID is really what you want, this gives your the process ID of the current shell. Maybe you want $UID the current user id?

Also $BASHPID is just an environment variable so you can't "execute" it just get its value
13 years ago
infact that was a terrible idea...sorry.
13 years ago
Maybe it would make your life easier if you used another variable to hold the value you want to print out instead of trying to work it from i and j, just a thought anyway.
13 years ago
You can use Pattern and Matcher if you want to search Strings for patterns / regex's

something like ..



would give you the index of each match in your string, or you can just use...



if you just need to find one occurance of <c>.

13 years ago