Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
It looks like it's a test to make sure that multiplying by two doesn't exceed the maximum or minimum value that an integer can hold. That is why the value is stored in a long which can hold a larger number, and then if it is greater or less than what an integer can store, it returns the maximum or minimum value that it can hold. If you have a 32 bit int, the values have to be within the range -2,147,483,648 to 2,147,483,647.
For example, if we pass a large number into the function like so: "doubleInteger(2111222333)" we can't just multiply that number by two (ie, return i * 2) because that number doubled is 4222444666. A method that simply calls "return i * 2" would actually give a result of -72522630 because as the number goes past the upper range of 2,147,483,647 it overflows and and adds to remaining value to the minimum value an integer can hold (so -2,147,483,648 + (4,222,444,666 - 2,147,483,647) = -72,522,630).
Here's an article for reference on overflowing variables: https://www.baeldung.com/java-overflow-underflow
What ?!
good, i don't it was possible to give regexp for replaceAll. thank you
really ? "best practices" to use old fashion way "loop" instead of lambda ? welcome back to 90's....