Description:
Fibonacci series, next number is the sum of previous two numbers for example 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 etc. The first two numbers of fibonacci series are 0 and 1.
Learn through my videos:

Program:
package javaapplication1;
import java.util.Scanner;
public class JavaApplication1 
{
    public static void main(String[] args) {
        // TODO code application logic here
        int k,a=1,b=1;
        Scanner sc=new Scanner(System.in);
        k=0;
        System.out.println("Enter a Number");
        int n=sc.nextInt();
        System.out.print("1 1 ");
        while(k<=n)
        {
            k=a+b;
            if(k>=n)
                break;
            System.out.print(k + " ");
            a=b;
            b=k;
        }        
    }

Output:
Enter a Number
22
1 1 2 3 5 8 13 21 
Logic:
The Fibonacci sequence is a set of numbers that starts with a one or a zero, followed by a one, and proceeds based on the rule that each number (called a Fibonacci number) is equal to the sum of the preceding two numbers.