Happy Number Program
Apart from what @RubberDuck said, you can also do a bit less work by not
converting from/to String, but iterating over the digits one by one
directly.  I've also moved the value to where it is initialised, that
way its scope is better visible.

After making those changes I arrive at the following snippet.  isHappy
or (isHappyNumber) can be reused and the main function only does
interface stuff.

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class HappyNumber
{
    public static boolean isHappy(int number)
    {
        Set&lt;Integer&gt; unique = new HashSet&lt;Integer&gt;();

        while (unique.add(number))
        {
            int value = 0;
            while (number &gt; 0)
            {
                value += Math.pow(number % 10, 2);
                number /= 10;
            }
            number = value;
        }

        return number == 1;
    }

    public static void main(String[] args)
    {
        System.out.print("Please enter a number: ");
        int number = new Scanner(System.in).nextInt();
        System.out.println(isHappy(number) ? "Happy" : "Not Happy");
    }
}