JAVA: How to find a specific object in array matching certain criteria?

I'm trying to find a certain block from my Block object Array by using the X, and Y specified from the UI. I have been using a locator array making duplicate entries alongside the main array in order to try this.

public Block get(int x, int y) {
            int index = 0;
            index = blocks.indexOf(locator[x][y], true);
            return blocks.get(index);

This however spits back an java.lang.ArrayIndexOutOfBoundsException: -1/

It seems like it would work but am I overlooking something?

This is the Error Returned

Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.ArrayIndexOutOfBoundsException: -1
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication$
Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
    at com.badlogic.gdx.utils.Array.get(
    at com.myname.javatest.World.get(
    at com.myname.javatest.ui.UserInterface.renderPositions(
    at com.myname.javatest.screens.GameScreen.render(
    at com.badlogic.gdx.Game.render(
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication$


Need Your Help

WPF Binding to variable / DependencyProperty

c# wpf xaml binding dependency-properties

I'm playing around with WPF Binding and variables. Apparently one can only bind DependencyProperties. I have come up with the following, which works perfectly fine:

Android thermometer

android battery temperature

Is it possible to implement a thermometer in Android? How?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.