这是我的数组,它由整数数组组成。实际上,这些是我的HashMap的关键,它由一些句子组成或者说一个完整段落的“STRING”作为一个关键值对。现在我想按照给定的顺序依次从整数数组中取出这些句子。Java:我想将整数数组转换为数学数字
int[] arr = {3, 2, 0, 5, 3};
HashMap<Integer, String> h = new HashMap<Integer, String>() {{
put(0,"This is my third sentence.");
put(3,"This is my first sentence.");
put(5,"This is my forth sentence.");
put(2,"This is my second sentence.");
}};
最终的输出应该是所有的罪并罚提到秩序和outout应该像一个段落:
这是我第sentence.This是我的第二sentence.This是我的第三句话。 这是我的第四句话。这是我的第一句话。
这只需要1个循环,就是这样。你试过什么了? – Aakash