using nQueens problem how to translate this algorithm to java code
function MIN-CONFLICTS(csp,max_steps) returns a solution or failure
inputs: csp, a constraint satisfaction problem
max_steps,the number of steps allowed before giving up
current<-- an initial assignment for csp
for i=1 to max_steps do
if current is a solution of csp then return current
var<-- a randomly chosen, conflicted variable from VARIABLES[csp]
value<-- the value v for var that minimizes CONFLICTS(var,v,current,csp)
set var = value in current
return failure