Hey there folks!
I came up this this solution in Java. I know, not all is implemented with the Math-funciton, but please give it a try .
Now this is another method to do this, but personally for me it’s not that beauty… but here you go
(I just couldn’t find any other solution in the Java API)
PS: I am not a nativ English speaker, please excuse my mistakes :c