Thread.currentThread().getStackTrace()[2].getLineNumber() but why just 2 and not for example 1? I also wonder why for [3] programme throws ArayIndexOfBounException <= I guess this it not the index of method