A neat Mathematics questions is how to check if a number is part of the Fibonacci sequence. This formula defines the Fibonacci sequence (assuming F0 = 0 and F1 = 1):
Source: Wikipedia
There are a couple of approaches to solve this problem, including the use of Binet's formula to determine if a number is part of the Fibonacci sequence.

For now, let's start out by defining a simple test case to follow test driven development. Since the Fibonacci sequence is infinite, we'll use Java's BigInteger class to handle numbers outside of the range of ints and longs.

@Test
    public void testIsFibonacciWithBigIntegers() {
        long startTime = System.currentTimeMillis();
        for (int i = 0; i < TestData.fibonacciNumbers.length; i++) {
            assertTrue(Fibonacci.iterativeIsFibonacci(TestData.fibonacciNumbers[i]));
        }

        for (int i = 0; i < TestData.nonFibonacciLargeNumbers.length; i++) {
            assertFalse(Fibonacci.iterativeIsFibonacci(TestData.nonFibonacciLargeNumbers[i]));
        }
        long endTime = System.currentTimeMillis();
        System.out.println("Completed iterative Fibonacci test in " + (endTime - startTime) + "ms");
    }
public class TestData {
    public static final BigInteger[] fibonacciNumbers = {
            new BigInteger("0"),
            new BigInteger("1"),
            new BigInteger("1"),
            new BigInteger("2"),
            new BigInteger("3"),
            ...
    public static final BigInteger[] nonFibonacciLargeNumbers = {
            new BigInteger("9539593446744073709551615"),
            new BigInteger("7492050343423470955161623"),
            new BigInteger("7382950684327734869302126"),
            new BigInteger("2382132136549430123910054"),
            ...

So now let's try the most obvious solution: iterate over the fibonacci sequence until we either exceed the number being tested or match it:

public static boolean isFibonacci(BigInteger number) {
        BigInteger Fprevious = BigInteger.ZERO, Fn = BigInteger.ONE;

        if (number.compareTo(BigInteger.ZERO) < 0) { return false; }
        if (number.equals(Fprevious) || number.equals(Fn)) { return true; }

        while (Fn.compareTo(number) < 0) {
            BigInteger temp = Fn;
            Fn = Fn.add(Fprevious);
            Fprevious = temp;

            if (Fn.compareTo(number) == 0) {
                return true;
            }
        }
        return false;
    }

This approach is far from ideal because every previous Fibonacci number must be iterated through. Another approach, proved by Phillip James, is to verify at least one of these calculations is a perfect square:
or
Let's try this out using Java's BigInteger class:

public static boolean binetIsFibonacci(BigInteger number) {
        if (number.compareTo(BigInteger.ZERO) < 0) { return false; }

        BigInteger product = number.pow(2), four = new BigInteger("4");
        product = product.multiply(new BigInteger("5"));

        if (BigIntegerMath.isSquare(product.add(four)) ||
            BigIntegerMath.isSquare(product.subtract(four))) { return true; }
        return false;
    }

BigIntegerMath.isSquare determines whether a given number is a perfect square using Newton's method. The source can be found here.

Unfortunately, the need to calculate the square root slows down the Fibonacci check so severely that the Binet approach takes 4 to 5 times longer than the above iterative approach as seen here:

Completed Binet Fibonacci test in     689ms
Completed iterative Fibonacci test in 150ms

All source code is available here: https://github.com/TomAlanCarroll/coding-practice/tree/master/src/main/java