Bao Truong

Greenhorn
+ Follow
since Oct 12, 2019
Bao likes ...
IntelliJ IDE Java Windows
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
5
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Bao Truong

I'm sorry for the late reply. So it seems we're good, and thanks to this I now know about BigDecimal. Really appreciate it guys.
3 years ago
This is my method to determine if a number is a square number, it is to solve a Kata over at Codewars

I submitted it and it passed all the test. But will there be some number whose square root's fraction part (the digits after the decimal point) is too small for even the double floating-point number to represent (for example 123.0000000000000000000000000000000000000000000000000000123123 with 52 zeros) so the square root will be seen as an integer and the method will return true while it is actually supposed to return false?
                                                                                                                                                                                                                                                                                                                             
4 years ago
Here's the first method with some changes and the method with no substring()

4 years ago
Thanks guys, I fixed the problem and made a less bulky version without using substring()
4 years ago
I need help with this method, which is to count how many times "hi" occurs in a string.

The code below works with "", " ", "hi" or anything with no more than one "hi" but seems to enters an infinite loop with strings that contain more than one "hi" such as "hihi".


4 years ago
I have a small question, in the command shell, what is the difference between typing >java HelloWorldApp and >java -cp . HelloWorldApp to run the HelloWorldApp program, they give the same results (printing out "Hello World") so which of them should I use?
4 years ago
Thank you very much guys for the help.
4 years ago

Liutauras Vilda wrote:@OP

The algorithm you got right, so I guess we just need to clarify, whether you understand why passing pos++ as an argument really was a mistake?


I need to use pos+1 instead because pos++ will only increment pos after the method have used it?
4 years ago
I want to design a method to compute the sum of numbers store in an array using recursion. This is what I have came up with.
   
This would cause the said error, I've checked it for anything that could cause the recursion to never terminate but still don't know what's wrong with it. Help :((
4 years ago