How to set test case priority in TestNG?

Below is the example:

package TestNG;
import org.testng.annotations.*;

public class SettingPriority
{
    @Test(priority = 0)
    public void method1() 
    {
    }

    @Test(priority = 1)
    public void method2() 
    {
    }

    @Test(priority = 2)
    public void method3() 
    {
    }
}

Method execution Sequence: method1, method2 and method3.