Finding all neighbours of a node sliding tile
Your code is really hard to read. I suggest the following:


Have four methods slideUp, slideDown, slideLeft, slideRight, each copying the this and applying the slide operation.
In the neighbour generation routine just check all the four, and whichever of them return a non-null result add to the list; finally, return the list.
Cache the index of the zero tile.


I had this in mind:

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Scanner;

public class SlidingTilePuzzleNode {

    private int[] state = new int[9];

    private int zeroTileIndex;

    public SlidingTilePuzzleNode() {
        for (int i = 0; i &lt; state.length - 1; ++i) {
            state[i] = i + 1;
        }

        zeroTileIndex = state.length - 1;
    }

    private SlidingTilePuzzleNode(int[] state, int zeroTileIndex) {
        this.state = state.clone();
        this.zeroTileIndex = zeroTileIndex;
    }

    public SlidingTilePuzzleNode slideUp() {
        int x = getX(zeroTileIndex);
        int y = getY(zeroTileIndex);

        if (y == 0) {
            return null;
        }

        int nextx = x;
        int nexty = y - 1;
        int nextIndex = xyToIndex(nextx, nexty);
        SlidingTilePuzzleNode node = new SlidingTilePuzzleNode(state,   
                                                               nextIndex);
        int tmp = node.state[nextIndex];
        node.state[nextIndex] = node.state[zeroTileIndex];
        node.state[zeroTileIndex] = tmp;
        return node;
    }

    public SlidingTilePuzzleNode slideDown() {
        int x = getX(zeroTileIndex);
        int y = getY(zeroTileIndex);

        if (y == 2) {
            return null;
        }

        int nextx = x;
        int nexty = y + 1;
        int nextIndex = xyToIndex(nextx, nexty);
        SlidingTilePuzzleNode node = new SlidingTilePuzzleNode(state,   
                                                               nextIndex);
        int tmp = node.state[nextIndex];
        node.state[nextIndex] = node.state[zeroTileIndex];
        node.state[zeroTileIndex] = tmp;
        return node;
    }

    public SlidingTilePuzzleNode slideLeft() {
        int x = getX(zeroTileIndex);
        int y = getY(zeroTileIndex);

        if (x == 0) {
            return null;
        }

        int nextx = x - 1;
        int nexty = y;
        int nextIndex = xyToIndex(nextx, nexty);
        SlidingTilePuzzleNode node = new SlidingTilePuzzleNode(state,   
                                                               nextIndex);
        int tmp = node.state[nextIndex];
        node.state[nextIndex] = node.state[zeroTileIndex];
        node.state[zeroTileIndex] = tmp;
        return node;
    }

    public SlidingTilePuzzleNode slideRight() {
        int x = getX(zeroTileIndex);
        int y = getY(zeroTileIndex);

        if (x == 2) {
            return null;
        }

        int nextx = x + 1;
        int nexty = y;
        int nextIndex = xyToIndex(nextx, nexty);
        SlidingTilePuzzleNode node = new SlidingTilePuzzleNode(state, 
                                                               nextIndex);
        int tmp = node.state[nextIndex];
        node.state[nextIndex] = node.state[zeroTileIndex];
        node.state[zeroTileIndex] = tmp;
        return node;
    }

    public Collection&lt;SlidingTilePuzzleNode&gt; getNeighbors() {
        List&lt;SlidingTilePuzzleNode&gt; neighborList = new ArrayList&lt;&gt;(4);
        SlidingTilePuzzleNode node = slideUp();

        if (node != null) {
            neighborList.add(node);
        }

        node = slideDown();

        if (node != null) {
            neighborList.add(node);
        }

        node = slideLeft();

        if (node != null) {
            neighborList.add(node);
        }

        node = slideRight();

        if (node != null) {
            neighborList.add(node);
        }

        return neighborList;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        int index = 0;

        for (int y = 0; y &lt; 3; ++y) {
            for (int x = 0; x &lt; 3; ++x) {
                sb.append(state[index++]);
            }
            sb.append("\n");
        }

        return sb.toString();
    }

    private static int getX(int index) {
        return index % 3;
    }

    private static int getY(int index) {
        return index / 3;
    }

    private static int xyToIndex(int x, int y) {
        return y * 3 + x;
    }

    public static void main(String[] args) {
        SlidingTilePuzzleNode node = new SlidingTilePuzzleNode();
        SlidingTilePuzzleNode tmpNode;
        Scanner scanner = new Scanner(System.in);

        while (true) {
            System.out.println(node);

            String cmd = scanner.nextLine().trim().toLowerCase();

            switch (cmd) {
                case "quit":
                case "exit":
                    System.exit(0);

                case "up":
                    tmpNode = node.slideUp();

                    if (tmpNode != null) {
                        node = tmpNode;
                    }

                    break;

                case "down":
                    tmpNode = node.slideDown();

                    if (tmpNode != null) {
                        node = tmpNode;
                    }

                    break;

                case "left":
                    tmpNode = node.slideLeft();

                    if (tmpNode != null) {
                        node = tmpNode;
                    }

                    break;

                case "right":
                    tmpNode = node.slideRight();

                    if (tmpNode != null) {
                        node = tmpNode;
                    }

                    break;
            }
        }
    }
}


Hope that helps.