I just want to implement the following in Java , Do anyone have some idea..?

```
public String method1(){

   //statement1
    .
    .
    .

   //statement 5
}

```

I want to set a timer for the statemen1 ( which involves some network communication ) . If the statement1 is not getting finished even after 25seconds , the control should go to statement 5 . how can I implement this in java ..?