Solved Triangle in java