I suggest that you use a Map<String, Integer>
instead:
Create the map by doing
Map<String, Integer> values = new HashMap<String, Integer>();
Then change
int temp = 10;
to
values.put("temp", 10);
and access the value using
int tempVal = values.get(temp_name);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…