@@ -0,0 +1,1287 @@
+package com.njust.test;%0A%0Aimport java.nio.CharBuffer;%0A%0Aimport org.junit.Assert;%0Aimport org.junit.Test;%0A%0Apublic class CharBufferDemo%0A%7B%0A    @Test%0A    public void test_wrap()%0A    %7B%0A        char%5B%5D chars = %22HelloWorld%22.toCharArray();%0A        %0A        // warp%E6%96%B9%E6%B3%95%0A        CharBuffer charBuffer = CharBuffer.wrap(chars);%0A        charBuffer.append(%22xxx%22);%0A        %0A        //%E4%BF%AE%E6%94%B9charBuffer%E4%BC%9A%E5%AF%BC%E8%87%B4%E5%8E%9F%E5%A7%8Bchar%E6%95%B0%E7%BB%84%E4%B9%9F%E8%A2%AB%E4%BF%AE%E6%94%B9%0A        char%5B%5D expect = %22xxxloWorld%22.toCharArray();%0A        Assert.assertArrayEquals(expect, chars);%0A        Assert.assertArrayEquals(expect, charBuffer.array());%0A    %7D%0A    %0A    @Test%0A    public void test_duplicate()%0A    %7B%0A        char%5B%5D chars = %22HelloWorld%22.toCharArray();%0A        // duplicate%E6%96%B9%E6%B3%95%0A        CharBuffer charBuffer = CharBuffer.wrap(chars).duplicate();%0A        charBuffer.append(%22123%22);%0A        %0A        //%0A        char%5B%5D expect = %22123loWorld%22.toCharArray();%0A        Assert.assertArrayEquals(expect, chars);%0A        Assert.assertArrayEquals(expect, charBuffer.array());%0A    %7D%0A    %0A    /**%0A     * %E5%BB%BA%E8%AE%AE%E8%BF%94%E5%9B%9E%E5%8F%AA%E8%AF%BB%E7%9A%84CharBuffer%0A     */%0A    @Test%0A    public void test_readonly()%0A    %7B%0A        char%5B%5D chars = %22HelloWorld%22.toCharArray();%0A        CharBuffer charBuffer = CharBuffer.wrap(chars).asReadOnlyBuffer();%0A        //java.nio.ReadOnlyBufferException%0A        //charBuffer.append(%22123%22);%0A    %7D%0A%7D%0A

Create CharBufferDemo.java