JavaDevNotes.com

Factorial Java

In mathematics, factorial of a number means taking the product of all positive integers less than or equal to the given number. Or the product of multiplying all numbers from one to the given number. For example, the factorial of 6 is 1x2x3x4x5x6=720. Factorial has many uses, specifically in combinatorics or counting problems, as this is a building block for coming up with more complex counting formula. However, this also have uses in other branch of mathematics, hence writing program that is math heavy may need to have a way of computing factorial. If you are working with the Java programming language, this post might help. This post will show example on how to compute factorial in Java. We will help write a factorial program in Java.

Fibonacci Java

The Fibonacci sequence is a very popular sequence in Math. The first two numbers in the sequence is 0 and 1. And all the succeeding numbers in the series is derived by adding the previous two numbers before it. For example, the third number in the sequence is derived by adding the first two which is 0 and 1, that equals to 1. The fourth is derived by adding the second and third 1+1 = 2. The fifth number is derived by adding the third and fourth 1+2 =3. And so on. And it is interesting to know that this sequence, which by first impression doesn't make sense, has many application in multiple discipline. For example, some traders who study technical analysis in stocks and other securities has observed that certain patterns in price movements follow the Fibonacci sequence. In software development, particularly in Agile practitioner, they follow task estimation using Fibonacci numbers. There are many more application of this. But this post will try to explore how to generate the Fibonacci series in Java.