From ec1d08774ec09bfdf651c25f5b491dc5af18f4da Mon Sep 17 00:00:00 2001
From: QQ-ing <932886072@qq.com>
Date: Sun, 26 Feb 2017 14:03:51 +0800
Subject: [PATCH 01/36] Create 932886072

just for test
---
 group16/932886072 | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 group16/932886072

diff --git a/group16/932886072 b/group16/932886072
new file mode 100644
index 0000000000..9daeafb986
--- /dev/null
+++ b/group16/932886072
@@ -0,0 +1 @@
+test

From 1a56267749758db44c0eb90e0d17b735103bc034 Mon Sep 17 00:00:00 2001
From: shane <baohua.shan@zhulebei.com>
Date: Sun, 26 Feb 2017 22:16:47 +0800
Subject: [PATCH 02/36] add BinaryTreeNode, update all Test

---
 .../src/com/coding/basic/BinaryTreeNode.java  | 60 ++++++++++++++++++-
 .../src/test/coding/basic/AbstractTest.java   |  5 ++
 .../test/coding/basic/BinaryTreeNodeTest.java | 32 ++++++++++
 3 files changed, 95 insertions(+), 2 deletions(-)
 create mode 100644 group16/214074094/src/test/coding/basic/BinaryTreeNodeTest.java

diff --git a/group16/214074094/src/com/coding/basic/BinaryTreeNode.java b/group16/214074094/src/com/coding/basic/BinaryTreeNode.java
index b40066ebe1..32417cb157 100644
--- a/group16/214074094/src/com/coding/basic/BinaryTreeNode.java
+++ b/group16/214074094/src/com/coding/basic/BinaryTreeNode.java
@@ -1,5 +1,11 @@
 package coding.basic;
 
+/**
+ * @Author shane
+ * @Time 2017/2/26 19:30
+ * @Email stevenchenguang@gmail.com
+ * @Desc Own BinaryTreeNode
+ */
 public class BinaryTreeNode {
 
     private Object data;
@@ -8,6 +14,31 @@ public class BinaryTreeNode {
 
     private BinaryTreeNode right;
 
+    public BinaryTreeNode insert(Object o) {
+        if (null == data) {
+            data = o;
+        } else {
+            if (bigger(data, o)) {
+                if (null == left) {
+                    left = new BinaryTreeNode();
+                    left.data = o;
+                } else {
+                    left.insert(o);
+                }
+            } else if (smaller(data, o)) {
+                if (null == right) {
+                    right = new BinaryTreeNode();
+                    right.data = o;
+                } else {
+                    right.insert(o);
+                }
+            } else {
+                throw new RuntimeException("The value has exists");
+            }
+        }
+        return this;
+    }
+
     public Object getData() {
         return data;
     }
@@ -32,8 +63,33 @@ public void setRight(BinaryTreeNode right) {
         this.right = right;
     }
 
-    public BinaryTreeNode insert(Object o) {
-        return null;
+    private boolean bigger(Object data1, Object data2) {
+        return data1.toString().compareTo(data2.toString()) > 0;
+    }
+
+    private boolean smaller(Object data1, Object data2) {
+        return data1.toString().compareTo(data2.toString()) < 0;
     }
 
+    private ArrayList list = new ArrayList();
+
+    /**
+     * 对二叉树进行遍历 结果存储到list中
+     */
+    private void sort(BinaryTreeNode node) {
+
+        list.add(node.data);
+        if(null != node.left){
+            sort(node.left);
+        }
+        if(null != node.right){
+            sort(node.right);
+        }
+    }
+
+    @Override
+    public String toString() {
+        sort(this);
+        return list.toString();
+    }
 }
diff --git a/group16/214074094/src/test/coding/basic/AbstractTest.java b/group16/214074094/src/test/coding/basic/AbstractTest.java
index 80eaaa6fe5..c0a7089660 100644
--- a/group16/214074094/src/test/coding/basic/AbstractTest.java
+++ b/group16/214074094/src/test/coding/basic/AbstractTest.java
@@ -1,5 +1,7 @@
 package coding.basic;
 
+import com.alibaba.fastjson.JSON;
+
 /**
  * @Author shane
  * @Time 2017/2/25 13:06
@@ -16,4 +18,7 @@ protected void printHyphen() {
         System.out.println("--------------------------------------------");
     }
 
+    protected void printJson(Object obj) {
+        System.out.println(JSON.toJSONString(obj));
+    }
 }
diff --git a/group16/214074094/src/test/coding/basic/BinaryTreeNodeTest.java b/group16/214074094/src/test/coding/basic/BinaryTreeNodeTest.java
new file mode 100644
index 0000000000..bd0f152820
--- /dev/null
+++ b/group16/214074094/src/test/coding/basic/BinaryTreeNodeTest.java
@@ -0,0 +1,32 @@
+package coding.basic;
+
+import org.junit.Test;
+
+/**
+ * @Author shane
+ * @Time 2017/2/26 19:57
+ * @Email shanbaohua@lxfintech.com
+ * @Desc ...
+ */
+public class BinaryTreeNodeTest extends AbstractTest {
+
+    @Test
+    public void test(){
+        BinaryTreeNode node = new BinaryTreeNode();
+        node.insert(8);
+        node.insert(5);
+        node.insert(9);
+        node.insert(1);
+        node.insert(6);
+        node.insert(11);
+        node.insert(10);
+        node.insert(15);
+        node.insert(13);
+        node.insert(19);
+
+        printStar();
+        System.out.println(node.getData());
+        System.out.println(node);
+        printStar();
+    }
+}

From 00b592b921c5e59f699802f5dcdcd53a699ee187 Mon Sep 17 00:00:00 2001
From: greenhills <63912401@qq.com>
Date: Sun, 26 Feb 2017 22:34:15 +0800
Subject: [PATCH 03/36] 63912401

---
 group16/63912401/.classpath                   |   6 +
 group16/63912401/.gitignore                   |   1 +
 group16/63912401/.project                     |  17 +
 .../src/com/coding/basic/ArrayList.java       | 192 +++++++++++
 .../src/com/coding/basic/BinaryTreeNode.java  |  99 ++++++
 .../src/com/coding/basic/Iterator.java        |   8 +
 .../src/com/coding/basic/LinkedList.java      | 320 ++++++++++++++++++
 .../63912401/src/com/coding/basic/List.java   |  16 +
 .../63912401/src/com/coding/basic/Queue.java  |  43 +++
 .../63912401/src/com/coding/basic/Stack.java  |  51 +++
 10 files changed, 753 insertions(+)
 create mode 100644 group16/63912401/.classpath
 create mode 100644 group16/63912401/.gitignore
 create mode 100644 group16/63912401/.project
 create mode 100644 group16/63912401/src/com/coding/basic/ArrayList.java
 create mode 100644 group16/63912401/src/com/coding/basic/BinaryTreeNode.java
 create mode 100644 group16/63912401/src/com/coding/basic/Iterator.java
 create mode 100644 group16/63912401/src/com/coding/basic/LinkedList.java
 create mode 100644 group16/63912401/src/com/coding/basic/List.java
 create mode 100644 group16/63912401/src/com/coding/basic/Queue.java
 create mode 100644 group16/63912401/src/com/coding/basic/Stack.java

diff --git a/group16/63912401/.classpath b/group16/63912401/.classpath
new file mode 100644
index 0000000000..10c33642b2
--- /dev/null
+++ b/group16/63912401/.classpath
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.7.0_67"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/group16/63912401/.gitignore b/group16/63912401/.gitignore
new file mode 100644
index 0000000000..ae3c172604
--- /dev/null
+++ b/group16/63912401/.gitignore
@@ -0,0 +1 @@
+/bin/
diff --git a/group16/63912401/.project b/group16/63912401/.project
new file mode 100644
index 0000000000..b6d8ce6204
--- /dev/null
+++ b/group16/63912401/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>coding2017</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>
diff --git a/group16/63912401/src/com/coding/basic/ArrayList.java b/group16/63912401/src/com/coding/basic/ArrayList.java
new file mode 100644
index 0000000000..a8d16b49a5
--- /dev/null
+++ b/group16/63912401/src/com/coding/basic/ArrayList.java
@@ -0,0 +1,192 @@
+package com.coding.basic;
+
+import java.util.Arrays;
+
+/** 
+ * ArrayList
+ * @author greenhills
+ * @version 创建时间：2017年2月19日 下午10:54:02 
+ * @param
+ * 
+ */
+public class ArrayList implements List {
+	/**
+	 * 默认容量
+	 */
+	private static final int DEFAULT_CAPACITY = 10;
+	
+	/**
+	 * 数据存放区
+	 */
+	private Object[] elementData;
+	
+	/**
+	 * 真实的数据数量
+	 */
+	private int size = 0;
+	
+	/**
+	 * 无参构造函数
+	 */
+	public ArrayList(){
+		this.elementData=new Object[DEFAULT_CAPACITY];
+	}
+	
+	/**
+	 * 带初始大小的构造函数
+	 * @param beginSize
+	 */
+	public ArrayList(int beginSize){
+		if(beginSize<0) 
+			this.elementData=new Object[DEFAULT_CAPACITY];
+		else
+			this.elementData=new Object[beginSize];
+	}
+	
+	/**
+	 * 在后面追加数据
+	 */
+	@Override
+	public void add(Object o){
+		autoGrow(size+1);
+		this.elementData[size++] = o; //在尾部追加数据
+	}
+	
+	/**
+	 * 把数据加入指定索引处
+	 */
+	@Override
+	public void add(int index, Object o){
+		rangeCheck(index);
+		autoGrow(size+1);
+		//把index处的所有数据往后移
+		//System.arraycopy(elementData, index, elementData, index+1, size-index);
+		
+		for(int i=size;i>index;i--){
+			elementData[i] = elementData[i-1];
+		}
+		
+		this.elementData[index] = o; //使数据连续加入
+		size++;
+	}
+	
+	/**
+	 * 获取指定索引处的数据
+	 */
+	@Override
+	public Object get(int index){
+		rangeCheck(index);
+		return elementData[index];
+	}
+	
+	/**
+	 * 移除索引处数据
+	 */
+	@Override
+	public Object remove(int index){
+		rangeCheck(index);
+		
+		Object removed = elementData[index];
+		int num=size - index - 1;  //移动数量
+		if(num>0) {
+			System.arraycopy(elementData, index+1, elementData, index,num);
+		}
+		elementData[--size] = null; //清除最后一个数据位
+		return removed;
+	}
+	
+	/**
+	 * 获取数据量
+	 */
+	@Override
+	public int size(){
+		return this.size;
+	}
+	
+	/**
+	 * 获取存储数据的容量大小
+	 */
+	@Override
+	public int capacity() {
+		return this.elementData.length;
+	}
+	
+	/**
+	 * 判断是否为空
+	 */
+	@Override
+	public boolean isEmpty() {
+		return this.size==0;
+	}
+
+	/**
+	 * 空间容量自增长
+	 * @param minCapacity 增长后最小容量
+	 */
+	private void autoGrow(int minCapacity){
+		int oldCapacity = elementData.length;
+		if (minCapacity >= oldCapacity) {
+		    int newCapacity = oldCapacity<<1;  //空间翻倍
+	    	if (newCapacity < minCapacity){
+	    		newCapacity = minCapacity;
+	    	}
+	        elementData = Arrays.copyOf(elementData, newCapacity);
+		}
+	}
+
+	/**
+	 * 判断是否为有效索引
+	 * @param @param index
+	 * @param @return
+	 */
+	private void rangeCheck(int index) {
+        if (!isEffectiveIndex(index))
+            throw new IndexOutOfBoundsException("Index: "+index+" Out Of Bounds, 有效数据索引范围:0~"+(this.size-1));
+    }
+	
+	/**
+	 * 判断是否为有效索引
+	 * @param @param index
+	 * @param @return
+	 */
+	private boolean isEffectiveIndex(int index){
+		return index >-1 && index < this.size;
+	}
+	
+	/**
+	 * 返回遍历数据对象
+	 * @param @return
+	 * @author greenhills
+	 * 2017年2月25日 下午9:55:31
+	 */
+	public Iterator iterator(){
+		return new Its();
+	}
+	
+	/**
+	 * 实现Iterator的内部实现类
+	 * Its
+	 * @author greenhills
+	 * 2017年2月25日 下午9:54:54
+	 */
+	private class Its implements Iterator {
+		private int index=0;
+		
+		public Its(){
+			//this.len = size;  //逆向遍历
+		}
+		
+		@Override
+		public boolean hasNext() {
+//			return this.len > 0;  //逆向遍历
+			return this.index < size; //正向遍历
+		}
+
+		@Override
+		public Object next() {
+//			return get(--this.len); //逆向遍历
+//			return elementData[--this.len];//逆向遍历
+			return get(this.index++); //正向遍历
+		}
+	}
+}
diff --git a/group16/63912401/src/com/coding/basic/BinaryTreeNode.java b/group16/63912401/src/com/coding/basic/BinaryTreeNode.java
new file mode 100644
index 0000000000..3ab1e431c0
--- /dev/null
+++ b/group16/63912401/src/com/coding/basic/BinaryTreeNode.java
@@ -0,0 +1,99 @@
+package com.coding.basic;
+
+/**
+ * 二叉树数据结构
+ * BinaryTreeNode
+ * @author greenhills
+ * 2017年2月25日 下午9:51:05
+ */
+public class BinaryTreeNode implements Comparable<Object>{
+	
+	private int height=0; //当前树高度
+	private Object data;        //当前节点数据
+	private BinaryTreeNode left;  //小于当前节点数据data的节点
+	private BinaryTreeNode right; //大于当前节点数据data的节点
+	
+	public BinaryTreeNode() {
+	}
+
+	public BinaryTreeNode(Object data) {
+		this.data = data;
+	}
+
+	public BinaryTreeNode insert(Object o){
+		BinaryTreeNode newNode=new BinaryTreeNode(o);
+		BinaryTreeNode that = findNode(o);
+		int result=that.compareTo(o);
+		
+		if(result<0){//节点数据小于插入数据，进右树
+			that.setRight(newNode);
+		}else if(result>0){ //当前节点数据大于插入数据，进左树
+			that.setLeft(newNode);
+		}else{
+			return null;
+		}
+		newNode.height++; //树高度加1
+		return  newNode;
+	}
+	
+	private BinaryTreeNode findNode(Object data){
+		int result=this.compareTo(data);
+		BinaryTreeNode that = new BinaryTreeNode(); //空节点
+		if(result<0){ //当前节点数据小于插入数据，进右树
+			if(this.right==null){
+				that = this;
+			}else{
+				that = findNode(this.getRight());
+			}
+		}else if(result>0){ //当前节点数据大于插入数据，进左树
+			if(this.left==null){
+				that = this;
+			}else{
+				that = findNode(this.getLeft());
+			}
+		}else{
+			System.out.println("无效数据");
+		}
+		return that;
+	}
+	
+	public int getTreeMaxHeight(){
+		int h=0;
+		//TODO
+		
+		return h;
+	}
+	
+	public int getHeight() {
+		return height;
+	}
+
+	public void setHeight(int height) {
+		this.height = height;
+	}
+
+	public Object getData() {
+		return data;
+	}
+	public void setData(Object data) {
+		this.data = data;
+	}
+	public BinaryTreeNode getLeft() {
+		return left;
+	}
+	public void setLeft(BinaryTreeNode left) {
+		this.left = left;
+	}
+	public BinaryTreeNode getRight() {
+		return right;
+	}
+	public void setRight(BinaryTreeNode right) {
+		this.right = right;
+	}
+
+	@Override
+	public int compareTo(Object o) {
+		if(this.data==null || o==null)  return 0;
+		return Double.valueOf(this.data.toString()).compareTo(Double.valueOf(o.toString()));
+	}
+}
diff --git a/group16/63912401/src/com/coding/basic/Iterator.java b/group16/63912401/src/com/coding/basic/Iterator.java
new file mode 100644
index 0000000000..fa815258c1
--- /dev/null
+++ b/group16/63912401/src/com/coding/basic/Iterator.java
@@ -0,0 +1,8 @@
+package com.coding.basic;
+
+
+public interface Iterator {
+	public boolean hasNext();
+	public Object next();
+
+}
diff --git a/group16/63912401/src/com/coding/basic/LinkedList.java b/group16/63912401/src/com/coding/basic/LinkedList.java
new file mode 100644
index 0000000000..2120a5a4b8
--- /dev/null
+++ b/group16/63912401/src/com/coding/basic/LinkedList.java
@@ -0,0 +1,320 @@
+package com.coding.basic;
+
+import java.util.NoSuchElementException;
+
+/**
+ * 链表数据结构
+ * LinkedList
+ * @author greenhills
+ * 2017年2月22日 下午11:52:41
+ */
+public class LinkedList implements List {
+	/**
+	 * 链表数据量
+	 */
+	private int size=0;
+	/**
+	 * 链表头节点
+	 */
+	private Node head;
+	/**
+	 * 链表尾节点
+	 */
+	private Node tail;
+	
+	
+	/**
+	 * 在数据链尾部添加数据
+	 */
+	@Override
+	public void add(Object o) {
+		addLast(o);
+	}
+	
+	/**
+	 * 在数据链指定位置添加数据
+	 */
+	@Override
+	public void add(int index, Object data) {
+		checkIndex(index);
+		Node old=getNode(index);
+        link2Before(old,data);
+	}
+	
+	/**
+	 * 获取指定索引处数据
+	 */
+	@Override
+	public Object get(int index) {
+		checkIndex(index);
+		return getNode(index).data;
+	}
+	
+	/**
+	 * 移除指定索引位置的节点
+	 */
+	@Override
+	public Object remove(int index) {
+		checkIndex(index);
+		return unlink(getNode(index));
+	}
+	
+	/**
+	 * 获取数据链的数据量
+	 */
+	@Override
+	public int size() {
+		return this.size;
+	}
+	
+	/**
+	 * 获取数据链的数据量
+	 */
+	@Override
+	@Deprecated
+	public int capacity() {
+		return size();
+	}
+	
+	/**
+	 * 判断是否为空
+	 */
+	@Override
+	public boolean isEmpty() {
+		return this.size==0;
+	}
+	
+	/**
+	 * 在数据链头部追加数据
+	 * @param data
+	 */
+	public void addFirst(Object data){
+		final Node oldNode=this.head;
+		final Node newNode=new Node(null,data,oldNode);//形成新节点，并指向第一个节点
+		this.head = newNode; //变更集合保存的首节点
+		
+		if(oldNode == null){ //没有数据
+			this.tail = newNode; //变更集合保存的尾节点
+		}else{
+			oldNode.prev = newNode; //原首节点指向新的首节点
+		}
+		this.size++;//数据量加1
+	}
+	
+	/**
+	 * 在数据链尾部追加数据
+	 * @param data
+	 */
+	public void addLast(Object data){
+		final Node oldNode=this.tail;
+		final Node newNode=new Node(oldNode,data,null);//形成新节点，并指向最后一个节点
+		this.tail = newNode; //变更集合保存的尾节点
+		
+		if(oldNode == null){ //没有数据
+			this.head = newNode; //变更集合保存的首节点
+		}else{
+			oldNode.next = newNode;//原尾节点指向新的尾节点
+		}
+		this.size++;//数据量加1
+	}
+	
+	/**
+	 * 把指定数据链接到指定节点前面
+	 */
+	void link2Before(Node node,Object data){
+		//传进来的node就是后节点
+		final Node prev=node.prev; //指定节点的上一个节点（前节点）
+		//生成新节点，并指向前后的节点
+		final Node newNode=new Node(prev,data,node);//生成新节点
+		//后节点指向新节点
+		node.prev = newNode;
+		//前节点指向新节点
+		if(prev == null){//没有前节点了（当前节点已是首节点）
+			this.head = newNode;//把新的节点作为首节点
+		}else{
+			prev.next = newNode;
+		}
+		this.size++;//数据量加1
+	}
+	
+	/**
+	 * 把指定数据链接到指定节点后面
+	 */
+	void link2Last(Node node,Object data){
+		//传进来的node就是前节点
+		final Node next=node.next; //指定节点的下一个节点(后节点)
+		//生成新节点，并指向前后的节点
+		final Node newNode=new Node(node,data,next);
+		//前节点指向新节点
+		node.next = newNode;
+		//后节点指向新节点
+		if(next == null){//没有后节点了（当前节点已是尾节点）
+			this.tail = newNode;//把新的节点作为尾节点
+		}else{
+			next.prev = newNode;
+		}
+		this.size++;//数据量加1
+	}
+	
+	/**
+	 * 移除首节点
+	 * @return
+	 */
+	public Object removeFirst(){
+		return unlink(getNode(0));
+	}
+	
+	/**
+	 * 移除尾节点
+	 * @return
+	 */
+	public Object removeLast(){
+		return unlink(getNode(this.size-1));
+	}
+	
+	/**
+	 * 移除节点
+	 * @return
+	 */
+	Object unlink(Node node){
+		final Object element = node.data;
+        final Node next = node.next; //下一个节点
+        final Node prev = node.prev;//前一个节点
+
+        if (prev == null) {//待删除节点是首节点
+            head = next;
+        } else {
+            prev.next = next;
+            node.prev = null;//解除待删除节点的引用关系
+        }
+
+        if (next == null) {//待删除节点是尾节点
+            tail = prev;
+        } else {
+            next.prev = prev;
+            node.next = null;//解除待删除节点的引用关系
+        }
+
+        node.data = null;//清除节点数据
+        size--;
+        return element;//返回清除节点数据
+	}
+	
+	/**
+	 * 在中间位置创建Iterator遍历
+	 * @return
+	 */
+	public Iterator iterator() {
+        return new Its(this.size>>1);
+    }
+	
+	/**
+	 * 在指定位置创建Iterator遍历
+	 * @return
+	 */
+	public Iterator iterator(int index) {
+		checkIndex(index);
+        return new Its(index);
+    }
+	
+	/**
+	 * 获取指定索引的节点对象
+	 * @param @param index
+	 * @param @return
+	 */
+	private Node getNode(int index){
+		if (index < (this.size >> 1)) { //在前半部分
+            Node node = this.head;
+            for (int i = 0; i < index; i++){
+            	node = node.next; //向后查找
+            }
+            return node;
+        } else { //在后半部分
+            Node node = this.tail;
+            for (int i = this.size - 1; i > index; i--){
+            	node = node.prev; //向前查找
+            }
+            return node;
+        }
+	}
+	
+	/**
+	 * 判断是否为有效索引
+	 * @param @param index
+	 * @param @return
+	 */
+	private boolean isEffectiveIndex(int index){
+		return (index>=0 && index < size);
+	}
+	
+	/**
+	 * 检测索引有效性，无效时抛出异常
+	 * @param index
+	 */
+	private void checkIndex(int index) {
+        if (!isEffectiveIndex(index))
+            throw new IndexOutOfBoundsException("Index: "+index+" Out Of Bounds, 最大索引: "+(size-1));
+    }
+	
+	
+	/**
+	 * 实现Iterator的内部实现类
+	 */
+	private class Its implements Iterator {
+		private Node lastReturned = null;
+        private Node node;//当前节点
+        private int index;//当前节点索引
+		
+		public Its(int index){
+			node = isEffectiveIndex(index) ? getNode(index) : null;
+			this.index = index;
+		}
+		
+		@Override
+		public boolean hasNext() {
+			return index < size;
+		}
+
+		@Override
+		public Object next() {
+			if (!hasNext())
+                throw new NoSuchElementException();
+
+            lastReturned = node;
+            node = node.next;
+            index++;
+            return lastReturned.data;
+			
+		}
+		
+		public boolean hasPrevious() {
+            return index >= 0;
+        }
+
+        public Object previous() {
+            if (!hasPrevious())
+                throw new NoSuchElementException();
+            
+            lastReturned = node;
+            node = node.prev;
+            index--;
+            return lastReturned.data;
+        }
+	}
+	
+	/**
+	 * 节点数据
+	 * Node
+	 */
+	private static class Node{
+		Object data;
+		Node prev;
+		Node next;
+		
+		Node(Node prev,Object data,Node next){
+			this.prev=prev;
+			this.data=data;
+			this.next=next;
+		}
+	}
+}
diff --git a/group16/63912401/src/com/coding/basic/List.java b/group16/63912401/src/com/coding/basic/List.java
new file mode 100644
index 0000000000..7fe012ccab
--- /dev/null
+++ b/group16/63912401/src/com/coding/basic/List.java
@@ -0,0 +1,16 @@
+package com.coding.basic;
+/** 
+ * 集合接口
+ * @author greenhills
+ * @version 创建时间：2017年2月19日 下午10:49:40 
+ * 
+ */
+public interface List {
+	public void add(Object o);
+	public void add(int index, Object o);
+	public Object get(int index);
+	public Object remove(int index);
+	public int size();
+	public int capacity();
+	boolean isEmpty();
+}
diff --git a/group16/63912401/src/com/coding/basic/Queue.java b/group16/63912401/src/com/coding/basic/Queue.java
new file mode 100644
index 0000000000..c6007c9e99
--- /dev/null
+++ b/group16/63912401/src/com/coding/basic/Queue.java
@@ -0,0 +1,43 @@
+package com.coding.basic;
+
+/**
+ * 队列数据结构
+ * Queue
+ * @author greenhills
+ * 2017年2月25日 下午9:50:04
+ */
+public class Queue {
+	private LinkedList elementData = new LinkedList();
+	
+	/**
+	 * 入队
+	 * @param o
+	 */
+	public void enQueue(Object o){
+		elementData.addLast(o);
+	}
+	
+	/**
+	 * 出队
+	 * @return
+	 */
+	public Object deQueue(){
+		return elementData.removeFirst();
+	}
+	
+	/**
+	 * 判断是否为空
+	 * @return
+	 */
+	public boolean isEmpty(){
+		return elementData.size()==0;
+	}
+	
+	/**
+	 * 获取栈内数据量
+	 * @return
+	 */
+	public int size(){
+		return elementData.size();
+	}
+}
diff --git a/group16/63912401/src/com/coding/basic/Stack.java b/group16/63912401/src/com/coding/basic/Stack.java
new file mode 100644
index 0000000000..8e1865f722
--- /dev/null
+++ b/group16/63912401/src/com/coding/basic/Stack.java
@@ -0,0 +1,51 @@
+package com.coding.basic;
+
+/**
+ * 栈数据结构
+ * Stack
+ * @author greenhills
+ * 2017年2月25日 下午9:49:41
+ */
+public class Stack {
+	private LinkedList elementData = new LinkedList();
+	
+	/**
+	 * 入栈
+	 * @param o
+	 */
+	public void push(Object o){	
+		elementData.addFirst(o);
+	}
+	
+	/**
+	 * 出栈
+	 * @return
+	 */
+	public Object pop(){
+		return elementData.removeFirst();
+	}
+	
+	/**
+	 * 获取栈顶数据
+	 * @return
+	 */
+	public Object peek(){
+		return elementData.get(0);
+	}
+	
+	/**
+	 * 判断是否为空
+	 * @return
+	 */
+	public boolean isEmpty(){
+		return elementData.size()==0;
+	}
+	
+	/**
+	 * 获取栈内数据量
+	 * @return
+	 */
+	public int size(){
+		return elementData.size();
+	}
+}

From 3a8239ae33d5973e05be7ae338687bb8c223c9be Mon Sep 17 00:00:00 2001
From: QQ-ing <932886072@qq.com>
Date: Sun, 26 Feb 2017 22:43:23 +0800
Subject: [PATCH 04/36] =?UTF-8?q?=E4=BD=9C=E4=B8=9A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 group16/932886072                         |  1 -
 group16/932886072/djj/ArrayList.java      | 64 +++++++++++++++
 group16/932886072/djj/BinaryTreeNode.java | 34 ++++++++
 group16/932886072/djj/Iterator.java       |  9 +++
 group16/932886072/djj/LinkedList.java     | 96 +++++++++++++++++++++++
 group16/932886072/djj/List.java           | 12 +++
 group16/932886072/djj/Queue.java          | 27 +++++++
 group16/932886072/djj/Stack.java          | 27 +++++++
 8 files changed, 269 insertions(+), 1 deletion(-)
 delete mode 100644 group16/932886072
 create mode 100644 group16/932886072/djj/ArrayList.java
 create mode 100644 group16/932886072/djj/BinaryTreeNode.java
 create mode 100644 group16/932886072/djj/Iterator.java
 create mode 100644 group16/932886072/djj/LinkedList.java
 create mode 100644 group16/932886072/djj/List.java
 create mode 100644 group16/932886072/djj/Queue.java
 create mode 100644 group16/932886072/djj/Stack.java

diff --git a/group16/932886072 b/group16/932886072
deleted file mode 100644
index 9daeafb986..0000000000
--- a/group16/932886072
+++ /dev/null
@@ -1 +0,0 @@
-test
diff --git a/group16/932886072/djj/ArrayList.java b/group16/932886072/djj/ArrayList.java
new file mode 100644
index 0000000000..df3a11c386
--- /dev/null
+++ b/group16/932886072/djj/ArrayList.java
@@ -0,0 +1,64 @@
+package djj;
+
+
+import java.util.Arrays;
+
+/**
+ * Created by jerry on 2017/2/26.
+ */
+public class ArrayList implements List {
+
+    private int size = 0;
+
+    private Object[] elementData = new Object[100];
+
+    public void add(Object o){
+        if(size>elementData.length*0.8){
+            Arrays.copyOf(elementData,elementData.length*2);
+        }
+        elementData[size]=o;
+        size++;
+    }
+    public void add(int index, Object o){
+        if (size>=index){
+            Object[] temp=new Object[elementData.length];
+            System.arraycopy(elementData,0,temp,0,index);
+            temp[index]=o;
+            System.arraycopy(elementData,index,temp,index+1,size-index);
+            elementData=temp;
+        }else if(size<index){
+            throw new RuntimeException("越界");
+        }
+        size++;
+    }
+
+    public Object get(int index){
+        if(index>size){
+            throw new RuntimeException("越界");
+        }else{
+            return elementData[index];
+        }
+    }
+
+    public Object remove(int index){
+        Object tempObj=null;
+        if(index<=size){
+            Object[] temp=new Object[elementData.length];
+            System.arraycopy(elementData,0,temp,0,index);
+            tempObj=elementData[index];
+            System.arraycopy(elementData,index+1,temp,index,size-index-1);
+            elementData=temp;
+        }
+        size--;
+        return tempObj;
+    }
+
+    public int size(){
+        return size;
+    }
+
+    public Iterator iterator(){
+        return null;
+    }
+
+}
diff --git a/group16/932886072/djj/BinaryTreeNode.java b/group16/932886072/djj/BinaryTreeNode.java
new file mode 100644
index 0000000000..d697be6ffc
--- /dev/null
+++ b/group16/932886072/djj/BinaryTreeNode.java
@@ -0,0 +1,34 @@
+package djj;
+
+public class BinaryTreeNode {
+
+	private BinaryTreeNode root;
+	private Object data;
+	private BinaryTreeNode left;
+	private BinaryTreeNode right;
+
+	public BinaryTreeNode insert(Object o){
+		
+		return  null;
+	}
+
+
+	public Object getData() {
+		return data;
+	}
+	public void setData(Object data) {
+		this.data = data;
+	}
+	public BinaryTreeNode getLeft() {
+		return left;
+	}
+	public void setLeft(BinaryTreeNode left) {
+		this.left = left;
+	}
+	public BinaryTreeNode getRight() {
+		return right;
+	}
+	public void setRight(BinaryTreeNode right) {
+		this.right = right;
+	}
+}
diff --git a/group16/932886072/djj/Iterator.java b/group16/932886072/djj/Iterator.java
new file mode 100644
index 0000000000..4482e3a408
--- /dev/null
+++ b/group16/932886072/djj/Iterator.java
@@ -0,0 +1,9 @@
+package djj;
+
+/**
+ * Created by jerry on 2017/2/26.
+ */
+public interface Iterator {
+    public boolean hasNext();
+    public Object next();
+}
diff --git a/group16/932886072/djj/LinkedList.java b/group16/932886072/djj/LinkedList.java
new file mode 100644
index 0000000000..6e40d5cc69
--- /dev/null
+++ b/group16/932886072/djj/LinkedList.java
@@ -0,0 +1,96 @@
+package djj;
+
+public class LinkedList implements List {
+	//头节点
+	private Node head;
+    //尾节点
+//    private Node tail;
+    //当前游标节点
+    private Node curNode;
+    public int size=0;
+
+	
+	public void add(Object o){
+		if(head==null){
+            head=new Node(o);
+            head.next=null;
+        }else{
+            curNode=head;
+            while(curNode.next!=null){
+                curNode=curNode.next;
+            }
+            curNode.next=new Node(o);
+        }
+        size++;
+	}
+	public void add(int index , Object o){
+        if(index>size||index<=0){
+            throw new RuntimeException("越界");
+        }else{
+            curNode=head;
+            for(int i=0;i<index;i++){
+                curNode=curNode.next;
+            }
+            Node newNode=new Node(o);
+            newNode.next=curNode.next;
+            curNode.next=newNode;
+            size++;
+        }
+	}
+	public Object get(int index){
+        if(index>size||index<=0){
+            throw new RuntimeException("越界");
+        }
+        Node temp=head;
+        for(int i=0;i<index;i++){
+            temp=temp.next;
+        }
+		return temp.data;
+	}
+	public Object remove(int index){
+        if(index>size||index<=0){
+            throw new RuntimeException("越界");
+        }
+        Node temp=head;
+        for(int i=0;i<index-1;i++){
+            temp=temp.next;
+        }
+        Node delNode=temp.next;
+        temp.next=delNode.next;
+        delNode.next=null;
+        size--;
+		return delNode.data;
+	}
+	
+	public int size(){
+		return this.size;
+	}
+	
+	public void addFirst(Object o){
+        add(1,o);
+	}
+	public void addLast(Object o){
+		add(size,o);
+	}
+	public Object removeFirst(){
+		return null;
+	}
+	public Object removeLast(){
+		return null;
+	}
+	public Iterator iterator(){
+		return null;
+	}
+	
+	
+	private static class Node{
+		Object data;
+		Node next;
+
+        public Node(Object o){
+            data=o;
+            next=null;
+        }
+
+	}
+}
diff --git a/group16/932886072/djj/List.java b/group16/932886072/djj/List.java
new file mode 100644
index 0000000000..d1e9a3b553
--- /dev/null
+++ b/group16/932886072/djj/List.java
@@ -0,0 +1,12 @@
+package djj;
+
+/**
+ * Created by jerry on 2017/2/26.
+ */
+public interface List {
+    public void add(Object o);
+    public void add(int index, Object o);
+    public Object get(int index);
+    public Object remove(int index);
+    public int size();
+}
diff --git a/group16/932886072/djj/Queue.java b/group16/932886072/djj/Queue.java
new file mode 100644
index 0000000000..37c9ce6dd0
--- /dev/null
+++ b/group16/932886072/djj/Queue.java
@@ -0,0 +1,27 @@
+package djj;
+
+import java.util.*;
+
+//队列
+public class Queue {
+	private LinkedList elementList;
+
+	//入队
+	public void enQueue(Object o){
+		elementList.add(o);
+	}
+
+	//出队
+	public Object deQueue(){
+		return elementList.remove(1);
+	}
+	
+	public boolean isEmpty(){
+		return elementList.size==0?true:false;
+
+	}
+	
+	public int size(){
+		return elementList.size;
+	}
+}
diff --git a/group16/932886072/djj/Stack.java b/group16/932886072/djj/Stack.java
new file mode 100644
index 0000000000..2d388760b2
--- /dev/null
+++ b/group16/932886072/djj/Stack.java
@@ -0,0 +1,27 @@
+package djj;
+//栈
+public class Stack {
+	private ArrayList elementData = new ArrayList();
+	private int pointer=0;
+	
+	public void push(Object o){
+		elementData.add(o);
+		pointer++;
+	}
+	
+	public Object pop(){
+		Object temp=elementData.remove(pointer);
+		pointer--;
+		return temp;
+	}
+	
+	public Object peek(){
+		return elementData.get(pointer);
+	}
+	public boolean isEmpty(){
+		return pointer==0?true:false;
+	}
+	public int size(){
+		return pointer;
+	}
+}

From 043f2e0bd9dfae6503768cc4bdd844fcb0411dfd Mon Sep 17 00:00:00 2001
From: greenhills <63912401@qq.com>
Date: Sun, 26 Feb 2017 22:44:01 +0800
Subject: [PATCH 05/36] 63912401

---
 group16/63912401/.classpath | 2 +-
 group16/63912401/.project   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/group16/63912401/.classpath b/group16/63912401/.classpath
index 10c33642b2..d171cd4c12 100644
--- a/group16/63912401/.classpath
+++ b/group16/63912401/.classpath
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
 	<classpathentry kind="src" path="src"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.7.0_67"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>
diff --git a/group16/63912401/.project b/group16/63912401/.project
index b6d8ce6204..ec6117b543 100644
--- a/group16/63912401/.project
+++ b/group16/63912401/.project
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <projectDescription>
-	<name>coding2017</name>
+	<name>63912401</name>
 	<comment></comment>
 	<projects>
 	</projects>

From 112528a3679a5cd2e84d41e11e6ad9ac06618bf8 Mon Sep 17 00:00:00 2001
From: greenhills <63912401@qq.com>
Date: Mon, 27 Feb 2017 00:30:58 +0800
Subject: [PATCH 06/36] greenhills <63912401@qq.com>

---
 .../src/com/coding/basic/ArrayList.java       | 14 +++++
 .../63912401/src/com/coding/basic/Stack.java  |  8 +--
 .../63912401/src/com/coding/basic/Stack2.java | 51 +++++++++++++++++++
 3 files changed, 69 insertions(+), 4 deletions(-)
 create mode 100644 group16/63912401/src/com/coding/basic/Stack2.java

diff --git a/group16/63912401/src/com/coding/basic/ArrayList.java b/group16/63912401/src/com/coding/basic/ArrayList.java
index a8d16b49a5..f86a2e7a8a 100644
--- a/group16/63912401/src/com/coding/basic/ArrayList.java
+++ b/group16/63912401/src/com/coding/basic/ArrayList.java
@@ -79,6 +79,13 @@ public Object get(int index){
 		return elementData[index];
 	}
 	
+	/**
+	 * 获取末尾数据
+	 */
+	public Object getLast(){
+		return elementData[this.size-1];
+	}
+	
 	/**
 	 * 移除索引处数据
 	 */
@@ -95,6 +102,13 @@ public Object remove(int index){
 		return removed;
 	}
 	
+	/**
+	 * 移除末尾数据
+	 */
+	public Object removeLast(){
+		return remove(this.size-1);
+	}
+	
 	/**
 	 * 获取数据量
 	 */
diff --git a/group16/63912401/src/com/coding/basic/Stack.java b/group16/63912401/src/com/coding/basic/Stack.java
index 8e1865f722..b343c6de1d 100644
--- a/group16/63912401/src/com/coding/basic/Stack.java
+++ b/group16/63912401/src/com/coding/basic/Stack.java
@@ -7,14 +7,14 @@
  * 2017年2月25日 下午9:49:41
  */
 public class Stack {
-	private LinkedList elementData = new LinkedList();
+	private ArrayList elementData = new ArrayList();
 	
 	/**
 	 * 入栈
 	 * @param o
 	 */
 	public void push(Object o){	
-		elementData.addFirst(o);
+		elementData.add(o);
 	}
 	
 	/**
@@ -22,7 +22,7 @@ public void push(Object o){
 	 * @return
 	 */
 	public Object pop(){
-		return elementData.removeFirst();
+		return elementData.removeLast();
 	}
 	
 	/**
@@ -30,7 +30,7 @@ public Object pop(){
 	 * @return
 	 */
 	public Object peek(){
-		return elementData.get(0);
+		return elementData.getLast();
 	}
 	
 	/**
diff --git a/group16/63912401/src/com/coding/basic/Stack2.java b/group16/63912401/src/com/coding/basic/Stack2.java
new file mode 100644
index 0000000000..8c10ccdf06
--- /dev/null
+++ b/group16/63912401/src/com/coding/basic/Stack2.java
@@ -0,0 +1,51 @@
+package com.coding.basic;
+
+/**
+ * 栈数据结构
+ * Stack
+ * @author greenhills
+ * 2017年2月25日 下午9:49:41
+ */
+public class Stack2 {
+	private LinkedList elementData = new LinkedList();
+	
+	/**
+	 * 入栈
+	 * @param o
+	 */
+	public void push(Object o){	
+		elementData.addFirst(o);
+	}
+	
+	/**
+	 * 出栈
+	 * @return
+	 */
+	public Object pop(){
+		return elementData.removeFirst();
+	}
+	
+	/**
+	 * 获取栈顶数据
+	 * @return
+	 */
+	public Object peek(){
+		return elementData.get(0);
+	}
+	
+	/**
+	 * 判断是否为空
+	 * @return
+	 */
+	public boolean isEmpty(){
+		return elementData.size()==0;
+	}
+	
+	/**
+	 * 获取栈内数据量
+	 * @return
+	 */
+	public int size(){
+		return elementData.size();
+	}
+}

From 3979b6993dcedfb4d5d08b58381a9d204aca4fe2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=AD=E5=B7=9E-=E5=A4=A7=E6=98=8E?= <420355244@qq.com>
Date: Mon, 27 Feb 2017 13:55:45 +0800
Subject: [PATCH 07/36] =?UTF-8?q?=E8=AF=BE=E5=90=8E=E4=B9=A0=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 group16/420355244/.classpath                  |   7 +
 group16/420355244/.gitignore                  |   1 +
 group16/420355244/.project                    |  17 ++
 .../src/com/coding/basic/ArrayList.java       |  91 +++++++
 .../src/com/coding/basic/ArrayListTest.java   |  64 +++++
 .../src/com/coding/basic/BinaryTreeNode.java  |  32 +++
 .../src/com/coding/basic/Iterator.java        |   7 +
 .../src/com/coding/basic/LinkedList.java      | 224 ++++++++++++++++++
 .../src/com/coding/basic/LinkedListTest.java  | 112 +++++++++
 .../420355244/src/com/coding/basic/List.java  |   9 +
 .../420355244/src/com/coding/basic/Queue.java |  66 ++++++
 .../src/com/coding/basic/QueueTest.java       |  56 +++++
 .../420355244/src/com/coding/basic/Stack.java |  39 +++
 .../src/com/coding/basic/StackTest.java       |  64 +++++
 14 files changed, 789 insertions(+)
 create mode 100644 group16/420355244/.classpath
 create mode 100644 group16/420355244/.gitignore
 create mode 100644 group16/420355244/.project
 create mode 100644 group16/420355244/src/com/coding/basic/ArrayList.java
 create mode 100644 group16/420355244/src/com/coding/basic/ArrayListTest.java
 create mode 100644 group16/420355244/src/com/coding/basic/BinaryTreeNode.java
 create mode 100644 group16/420355244/src/com/coding/basic/Iterator.java
 create mode 100644 group16/420355244/src/com/coding/basic/LinkedList.java
 create mode 100644 group16/420355244/src/com/coding/basic/LinkedListTest.java
 create mode 100644 group16/420355244/src/com/coding/basic/List.java
 create mode 100644 group16/420355244/src/com/coding/basic/Queue.java
 create mode 100644 group16/420355244/src/com/coding/basic/QueueTest.java
 create mode 100644 group16/420355244/src/com/coding/basic/Stack.java
 create mode 100644 group16/420355244/src/com/coding/basic/StackTest.java

diff --git a/group16/420355244/.classpath b/group16/420355244/.classpath
new file mode 100644
index 0000000000..3e0fb272a8
--- /dev/null
+++ b/group16/420355244/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/group16/420355244/.gitignore b/group16/420355244/.gitignore
new file mode 100644
index 0000000000..ae3c172604
--- /dev/null
+++ b/group16/420355244/.gitignore
@@ -0,0 +1 @@
+/bin/
diff --git a/group16/420355244/.project b/group16/420355244/.project
new file mode 100644
index 0000000000..aec36208a6
--- /dev/null
+++ b/group16/420355244/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>Homework</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>
diff --git a/group16/420355244/src/com/coding/basic/ArrayList.java b/group16/420355244/src/com/coding/basic/ArrayList.java
new file mode 100644
index 0000000000..6534c3c029
--- /dev/null
+++ b/group16/420355244/src/com/coding/basic/ArrayList.java
@@ -0,0 +1,91 @@
+package com.coding.basic;
+
+import java.util.Arrays;
+
+public class ArrayList implements List {
+	
+	private int size = 0;
+	
+	private Object[] elementData = new Object[100];
+	
+	public void add(Object o){
+		if(size < elementData.length){
+			elementData[size] = o;
+		}else{
+			Object[] newElementData = new Object[elementData.length + elementData.length/2];
+			System.arraycopy(elementData, 0, newElementData, 0, size);
+			newElementData[size] = o;
+			this.elementData = newElementData;
+		}
+		size++;
+		
+	}
+	public void add(int index, Object o){
+		if(index >= 0 && index <= size){
+			//1.不扩容
+			if(index == size - 1){
+				//1.1 加在最后
+				elementData[index] = o;
+			}else{
+				//1.2 加在前面
+				//index的位置的数值变为改对象，index以后位置的都往后挪一位
+				Object[] newElementData = new Object[elementData.length];
+				System.arraycopy(elementData, 0, newElementData, 0, index);
+				newElementData[index] = o ;
+				System.arraycopy(elementData, index, newElementData, index + 1, size - index);
+				this.elementData = newElementData;
+			}
+			size++;
+		}else{
+			throw new IndexOutOfBoundsException();
+		}
+	}
+	
+	public Object get(int index){
+		if(index < size){
+			return elementData[index];
+		}else{
+			throw new IndexOutOfBoundsException();
+		}
+	}
+	
+	public Object remove(int index){
+		if(index < size){
+			Object obj = elementData[index];
+			Object[] newElementData = new Object[elementData.length];
+			if(size != 1){
+				//1.若集合长度为1
+				if(0 == index){
+					//1.1.如果remove的是0索引的
+					System.arraycopy(elementData, 1, newElementData, 0, size - 1);
+				}else if(index == size -1){
+					//1.2.如果remove的是最后索引的
+					System.arraycopy(elementData, 0, newElementData, 0, size - 1);
+				}else{
+					//1.3.在中间
+					System.arraycopy(elementData, 0, newElementData, 0, index);
+					System.arraycopy(elementData, index + 1, newElementData, index, size - index - 1);
+				}
+			}
+			this.elementData = newElementData;
+			size--;
+			return obj;
+		}else{
+			throw new IndexOutOfBoundsException();
+		}
+	}
+	
+	public int size(){
+		return size;
+	}
+	
+	public Iterator iterator(){
+		return null;
+	}
+	@Override
+	public String toString() {
+		return "ArrayList [size=" + size + ", elementData=" + Arrays.toString(elementData) + "]";
+	}
+	
+	
+}
diff --git a/group16/420355244/src/com/coding/basic/ArrayListTest.java b/group16/420355244/src/com/coding/basic/ArrayListTest.java
new file mode 100644
index 0000000000..2f48bdf4c8
--- /dev/null
+++ b/group16/420355244/src/com/coding/basic/ArrayListTest.java
@@ -0,0 +1,64 @@
+package com.coding.basic;
+
+import static org.junit.Assert.fail;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class ArrayListTest {
+
+	private static ArrayList arrayList = new ArrayList();
+	
+	@Before
+	public void setUp() throws Exception {
+	}
+
+	@Test
+	public void testAddObject() {
+		for(int i = 0 ;i < 150; i++){
+			arrayList.add("aaa");
+		}
+		System.out.println(arrayList);
+		System.out.println(arrayList.size());
+	}
+
+	@Test
+	public void testAddIntObject() {
+		arrayList.add("aaa");
+		arrayList.add("bbb");
+		arrayList.add("ccc");
+		arrayList.add("ddd");
+		arrayList.add(1,"eee");
+		System.out.println(arrayList);
+	}
+
+	@Test
+	public void testGet() {
+		arrayList.add("aaa");
+		arrayList.add("bbb");
+		arrayList.add("ccc");
+		arrayList.add("ddd");
+		Object object = arrayList.get(0);
+		System.out.println(object);
+	}
+
+	@Test
+	public void testRemove() {
+		arrayList.add("aaa");
+		arrayList.add("bbb");
+		arrayList.add("ccc");
+		arrayList.add("ddd");
+		arrayList.remove(0);
+		System.out.println(arrayList);
+	}
+
+	@Test
+	public void testSize() {
+		arrayList.add("aaa");
+		arrayList.add("bbb");
+		arrayList.add("ccc");
+		arrayList.add("ddd");
+		System.out.println(arrayList.size());
+	}
+
+}
diff --git a/group16/420355244/src/com/coding/basic/BinaryTreeNode.java b/group16/420355244/src/com/coding/basic/BinaryTreeNode.java
new file mode 100644
index 0000000000..d7ac820192
--- /dev/null
+++ b/group16/420355244/src/com/coding/basic/BinaryTreeNode.java
@@ -0,0 +1,32 @@
+package com.coding.basic;
+
+public class BinaryTreeNode {
+	
+	private Object data;
+	private BinaryTreeNode left;
+	private BinaryTreeNode right;
+	
+	public Object getData() {
+		return data;
+	}
+	public void setData(Object data) {
+		this.data = data;
+	}
+	public BinaryTreeNode getLeft() {
+		return left;
+	}
+	public void setLeft(BinaryTreeNode left) {
+		this.left = left;
+	}
+	public BinaryTreeNode getRight() {
+		return right;
+	}
+	public void setRight(BinaryTreeNode right) {
+		this.right = right;
+	}
+	
+	public BinaryTreeNode insert(Object o){
+		return  null;
+	}
+	
+}
diff --git a/group16/420355244/src/com/coding/basic/Iterator.java b/group16/420355244/src/com/coding/basic/Iterator.java
new file mode 100644
index 0000000000..06ef6311b2
--- /dev/null
+++ b/group16/420355244/src/com/coding/basic/Iterator.java
@@ -0,0 +1,7 @@
+package com.coding.basic;
+
+public interface Iterator {
+	public boolean hasNext();
+	public Object next();
+
+}
diff --git a/group16/420355244/src/com/coding/basic/LinkedList.java b/group16/420355244/src/com/coding/basic/LinkedList.java
new file mode 100644
index 0000000000..9af35a399d
--- /dev/null
+++ b/group16/420355244/src/com/coding/basic/LinkedList.java
@@ -0,0 +1,224 @@
+package com.coding.basic;
+
+import java.util.NoSuchElementException;
+
+public class LinkedList implements List {
+	
+	
+	private Node first;
+	
+	private Node last;
+	
+	private int size = 0;
+	
+	public void add(Object o){
+		if(null == first){
+			//当链表元素为空时，新建一个Node
+			Node node = new Node();
+			node.data = o;
+			node.next = null;
+			first = node;
+			last = node;
+			size ++;
+		}else{
+			addLast(o);
+		}
+	}
+	public void add(int index , Object o){
+		if(index < 0 || index >= size){
+			//数组越界异常
+			throw new IndexOutOfBoundsException();
+		}else{
+			if(0 == index){
+				//1.如果加在头上
+				addFirst(o);
+			}else{
+				//2.加在中间位置
+				Node node = first.next;
+				int nodeIndex = 1;
+				if(nodeIndex == index){
+					//如果是第二个位置的话
+					Node nodeAdd = new Node();
+					nodeAdd.data = o;
+					first.next = nodeAdd;
+					nodeAdd.next = node;
+					last = node;
+					size ++;
+				}
+				//第三个位置及以后、开始遍历所有的索引
+				while(null != node.next){
+					//保留遍历中node之前的结点
+					Node nodeLast = node;
+					node = node.next;
+					nodeIndex++;
+					if(nodeIndex == index){
+						Node nodeAdd = new Node();
+						nodeAdd.data = o;
+						nodeLast.next = nodeAdd;
+						nodeAdd.next = node;
+						size ++;
+						break;
+					}
+				}
+			}
+		}
+		
+	}
+	public Object get(int index){
+		if(index < 0 || index >= size){
+			//数组越界异常
+			throw new IndexOutOfBoundsException();
+		}else{
+			if(0 == index){
+				//1.如果加在头上
+				return first.data;
+			}
+			Node node = first.next;
+			int nodeIndex = 1;
+			if(nodeIndex == index){
+				//如果是第二个位置的话
+				return node.data;
+			}
+			//第三个位置及以后、开始遍历所有的索引
+			while(null != node.next){
+				//保留遍历中node之前的结点
+				node = node.next;
+				nodeIndex++;
+				if(nodeIndex == index){
+					return node.data;
+				}
+			}
+		}
+		throw new IndexOutOfBoundsException();
+	}
+	public Object remove(int index){
+		if(index < 0 || index >= size){
+			//数组越界异常
+			throw new IndexOutOfBoundsException();
+		}else{
+			if(0 == index){
+				//1.如果移除头
+				removeFirst();
+			}else if(index == (size - 1)){
+				//2.移除尾
+				removeLast();
+			}else{
+				//3.移除中间位置
+				Node node = first.next;
+				//从first的零号索引开始
+				int nodeIndex = 1;
+				
+				//开始遍历所有的索引，记住要移除的索引位数据的前后结点
+				Node lastNode = first;
+				if(index == nodeIndex){
+					//第一次不匹配则后续的循环执行
+					Object o = node.data;
+					lastNode.next = node.next;
+					size--;
+					return o;
+				}else{
+					while(null != node.next){
+						lastNode = node;
+						node = node.next;
+						nodeIndex++;
+						if(index == nodeIndex){
+							Object o = node.data;
+							lastNode.next = node.next;
+							size--;
+							return o;
+						}
+					}
+				}
+			}
+		}
+		throw new IndexOutOfBoundsException();
+	}
+	
+	public int size(){
+		return size;
+	}
+	
+	public void addFirst(Object o){
+		Node node = new Node();
+		node.data = o ;
+		node.next = first;
+		first = node;
+		size++;
+	}
+	public void addLast(Object o){
+		Node node = new Node();
+		node.data = o ;
+		node.next = null;
+		last.next = node;
+		last = node;
+		size++;
+	}
+	public Object removeFirst(){
+		Object o = first.data;
+		Node node = first.next;
+		first = node;
+		size--;
+		return o;
+	}
+	public Object removeLast(){
+		if(0 == size){
+			throw new NoSuchElementException();
+			
+		}else if(1 == size){
+			//只有一个元素
+			removeFirst();
+		}else{
+			//第二个元素
+			Node node = first.next;
+			if(null == node.next){
+				Object o = node.data;
+				last = first;
+				first.next = null;
+				return o;
+			}else{
+				while(null != node.next){
+					//若不止只有2个 ，记录最后一个结点的前一个。
+					Node lastNode = node;
+					node = node.next;
+					if(null == node.next){
+						Object o = node.data;
+						lastNode.next = null;
+						last = lastNode;
+						size--;
+						return o;
+					}
+				}
+			}
+		}
+		throw new NoSuchElementException();
+	}
+	public Iterator iterator(){
+		return null;
+	}
+	
+	
+	private static  class Node{
+		Object data;
+		Node next;
+		
+	}
+
+
+	@Override
+	public String toString() {
+		StringBuilder sb = new StringBuilder();
+		if(null != first){
+			sb.append(first.data.toString() + ",");
+			Node node = first.next;
+			sb.append(node.data.toString() + ",");
+			while(null != node.next){
+				node = node.next;
+				sb.append(node.data.toString() + ",");
+			}
+		}
+		return sb.toString();
+	}
+
+
+	
+}
diff --git a/group16/420355244/src/com/coding/basic/LinkedListTest.java b/group16/420355244/src/com/coding/basic/LinkedListTest.java
new file mode 100644
index 0000000000..2caea9679b
--- /dev/null
+++ b/group16/420355244/src/com/coding/basic/LinkedListTest.java
@@ -0,0 +1,112 @@
+package com.coding.basic;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class LinkedListTest {
+	private static LinkedList linkedList = new LinkedList();
+	@Before
+	public void setUp() throws Exception {
+	}
+
+	@Test
+	public void testAddObject() {
+		linkedList.add("aaa");
+		linkedList.add("bbb");
+		System.out.println(linkedList);
+	}
+
+	@Test
+	public void testAddIntObject() {
+		linkedList.add("aaa");
+		linkedList.add("bbb");
+		linkedList.add("ccc");
+		linkedList.add(2,"ddd");
+		System.out.println(linkedList);
+		System.out.println(linkedList.size());
+	}
+
+	@Test
+	public void testGet() {
+		linkedList.add("aaa");
+		linkedList.add("bbb");
+		linkedList.add("ccc");
+		linkedList.add("eee");
+		linkedList.add("fff");
+		linkedList.add("ddd");
+//		System.out.println(linkedList.size());
+		System.out.println(linkedList.get(3));
+	}
+
+	@Test
+	public void testRemove() {
+		linkedList.add("aaa");
+		linkedList.add("bbb");
+		linkedList.add("ccc");
+		linkedList.add("eee");
+		linkedList.add("fff");
+		linkedList.add("ddd");
+		linkedList.remove(5);
+		linkedList.remove(1);
+		linkedList.remove(2);
+		System.out.println(linkedList);
+		System.out.println(linkedList.size());
+	}
+
+	@Test
+	public void testSize() {
+		linkedList.add("aaa");
+		linkedList.add("bbb");
+		linkedList.add("ccc");
+		linkedList.add("eee");
+		linkedList.add("fff");
+		linkedList.add("ddd");
+		System.out.println(linkedList.size());
+	}
+
+	@Test
+	public void testAddFirst() {
+		linkedList.add("aaa");
+		linkedList.add("bbb");
+		linkedList.addFirst("sss");
+		System.out.println(linkedList);
+	}
+
+	@Test
+	public void testAddLast() {
+		linkedList.add("aaa");
+		linkedList.add("bbb");
+		linkedList.add("ccc");
+		System.out.println(linkedList);
+	}
+
+	@Test
+	public void testRemoveFirst() {
+		linkedList.add("aaa");
+		linkedList.add("bbb");
+		linkedList.add("ccc");
+		linkedList.removeFirst();
+		linkedList.addFirst("eee");
+		linkedList.removeFirst();
+		System.out.println(linkedList);
+	}
+
+	@Test
+	public void testRemoveLast() {
+		linkedList.add("aaa");
+		linkedList.add("bbb");
+		linkedList.add("ccc");
+		linkedList.removeLast();
+		linkedList.add("eee");
+		linkedList.addFirst("xxx");
+		System.out.println(linkedList);
+	}
+
+	@Test
+	public void testIterator() {
+		fail("Not yet implemented");
+	}
+
+}
diff --git a/group16/420355244/src/com/coding/basic/List.java b/group16/420355244/src/com/coding/basic/List.java
new file mode 100644
index 0000000000..10d13b5832
--- /dev/null
+++ b/group16/420355244/src/com/coding/basic/List.java
@@ -0,0 +1,9 @@
+package com.coding.basic;
+
+public interface List {
+	public void add(Object o);
+	public void add(int index, Object o);
+	public Object get(int index);
+	public Object remove(int index);
+	public int size();
+}
diff --git a/group16/420355244/src/com/coding/basic/Queue.java b/group16/420355244/src/com/coding/basic/Queue.java
new file mode 100644
index 0000000000..a2f9577b7b
--- /dev/null
+++ b/group16/420355244/src/com/coding/basic/Queue.java
@@ -0,0 +1,66 @@
+package com.coding.basic;
+
+public class Queue {
+	private Node first;
+	private Node last;
+	private int size = 0;
+	public void enQueue(Object o){	
+		if(null == first){
+			Node node = new Node();
+			node.data = o;
+			node.next = null;
+			first = node;
+			last = node;
+		}else{
+			Node node = new Node();
+			node.data = o;
+			node.next = null;
+			last.next = node;
+			last = node;
+		}
+		size++;
+	}
+	
+	public Object deQueue(){
+		Node second = first.next;
+		Object o = first.data;
+		if(null != second){
+			first = second;
+			return o;
+		}else{
+			first = null;
+			size = 0;
+			return o;
+		}
+	}
+	
+	public boolean isEmpty(){
+		if(size > 0){
+			return false;
+		}else{
+			return true;
+		}
+	}
+	
+	public int size(){
+		return size;
+	}
+	static class Node{
+		Node next;
+		Object data;
+	}
+	@Override
+	public String toString() {
+		StringBuilder sb = new StringBuilder();
+		if(null != first){
+			sb.append(first.data.toString() + ",");
+			Node node = first.next;
+			sb.append(node.data.toString() + ",");
+			while(null != node.next){
+				node = node.next;
+				sb.append(node.data.toString() + ",");
+			}
+		}
+		return sb.toString();
+	}
+}
diff --git a/group16/420355244/src/com/coding/basic/QueueTest.java b/group16/420355244/src/com/coding/basic/QueueTest.java
new file mode 100644
index 0000000000..50d7fc0903
--- /dev/null
+++ b/group16/420355244/src/com/coding/basic/QueueTest.java
@@ -0,0 +1,56 @@
+package com.coding.basic;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class QueueTest {
+
+	public static Queue queue = new Queue();
+	@Before
+	public void setUp() throws Exception {
+	}
+
+	@Test
+	public void testEnQueue() {
+		queue.enQueue("aaa");
+		queue.enQueue("bbb");
+		queue.enQueue("ccc");
+		queue.enQueue("aaa");
+		System.out.println(queue);
+	}
+
+	@Test
+	public void testDeQueue() {
+		queue.enQueue("aaa");
+		queue.enQueue("bbb");
+		queue.enQueue("ccc");
+		queue.enQueue("ddd");
+		queue.enQueue("eee");
+		queue.deQueue();
+		System.out.println(queue);
+	}
+
+	@Test
+	public void testIsEmpty() {
+		System.out.println(queue.isEmpty());
+		
+	}
+
+	@Test
+	public void testSize() {
+		queue.enQueue("aaa");
+		queue.enQueue("bbb");
+		queue.enQueue("ccc");
+		queue.enQueue("ddd");
+		queue.enQueue("eee");
+		System.out.println(queue.size());
+	}
+
+	@Test
+	public void testToString() {
+		fail("Not yet implemented");
+	}
+
+}
diff --git a/group16/420355244/src/com/coding/basic/Stack.java b/group16/420355244/src/com/coding/basic/Stack.java
new file mode 100644
index 0000000000..5c59bf34fc
--- /dev/null
+++ b/group16/420355244/src/com/coding/basic/Stack.java
@@ -0,0 +1,39 @@
+package com.coding.basic;
+
+public class Stack {
+	private ArrayList elementData = new ArrayList();
+	private int size = 0;
+	public void push(Object o){	
+		//入栈在栈顶进入最后压入
+		elementData.add(o);
+		size ++;
+	}
+	
+	public Object pop(){
+		Object object = elementData.get(size -1);
+		elementData.remove(size -1);
+		size --;
+		return object;
+	}
+	
+	public Object peek(){
+		Object object = elementData.get(size -1);
+		return object;
+	}
+	public boolean isEmpty(){
+		if(size <= 0){
+			return true;
+		}else{
+			return false;
+		}
+	}
+	public int size(){
+		return size;
+	}
+
+	@Override
+	public String toString() {
+		return elementData.toString();
+	}
+	
+}
diff --git a/group16/420355244/src/com/coding/basic/StackTest.java b/group16/420355244/src/com/coding/basic/StackTest.java
new file mode 100644
index 0000000000..0628e7c76e
--- /dev/null
+++ b/group16/420355244/src/com/coding/basic/StackTest.java
@@ -0,0 +1,64 @@
+package com.coding.basic;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class StackTest {
+	private static Stack stack = new Stack();
+	@Before
+	public void setUp() throws Exception {
+	}
+
+	@Test
+	public void testPush() {
+		stack.push("aaa");
+		stack.push("bbb");
+		stack.push("ccc");
+		System.out.println(stack);
+	}
+
+	@Test
+	public void testPop() {
+		stack.push("aaa");
+		stack.push("bbb");
+		stack.push("ccc");
+		Object pop = stack.pop();
+		System.out.println(pop);
+		System.out.println(stack);
+	}
+
+	@Test
+	public void testPeek() {
+		stack.push("aaa");
+		stack.push("bbb");
+		stack.push("ccc");
+		Object peek = stack.peek();
+		System.out.println(peek);
+	}
+
+	@Test
+	public void testIsEmpty() {
+		System.out.println(stack.isEmpty());
+		stack.push("aaa");
+		stack.push("bbb");
+		stack.push("ccc");
+		System.out.println(stack.isEmpty());
+		stack.pop();
+		stack.pop();
+		stack.pop();
+		System.out.println(stack.isEmpty());
+	}
+
+	@Test
+	public void testSize() {
+		stack.push("aaa");
+		stack.push("bbb");
+		stack.push("ccc");
+		stack.pop();
+		stack.pop();
+		System.out.println(stack.size());
+	}
+
+}

From a61dab0ae2214ce81c66fee51e730ef8deebd5b5 Mon Sep 17 00:00:00 2001
From: Li Han <hiliguoxin@foxmail.com>
Date: Mon, 27 Feb 2017 16:35:14 +0800
Subject: [PATCH 08/36] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=83=A8=E5=88=86Array?=
 =?UTF-8?q?=E4=BD=9C=E4=B8=9A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

完成数组置换和去零
---
 group16/502059278/.classpath                  |   1 +
 ...350\260\210_\344\275\234\344\270\232.docx" | Bin 532875 -> 0 bytes
 .../cn/mark/{ => work0219}/MyArrayList.java   |   2 +-
 .../cn/mark/{ => work0219}/MyLinkedList.java  |   2 +-
 .../src/cn/mark/{ => work0219}/MyList.java    |   2 +-
 .../src/cn/mark/work0226/ArrayUtil.java       | 130 ++++++++++++++++++
 .../src/cn/mark/work0226/TestArrayUtil.java   |  35 +++++
 7 files changed, 169 insertions(+), 3 deletions(-)
 delete mode 100644 "group16/502059278/homework/\350\256\241\347\256\227\346\234\272\346\274\253\350\260\210_\344\275\234\344\270\232.docx"
 rename group16/502059278/src/cn/mark/{ => work0219}/MyArrayList.java (99%)
 rename group16/502059278/src/cn/mark/{ => work0219}/MyLinkedList.java (97%)
 rename group16/502059278/src/cn/mark/{ => work0219}/MyList.java (96%)
 create mode 100644 group16/502059278/src/cn/mark/work0226/ArrayUtil.java
 create mode 100644 group16/502059278/src/cn/mark/work0226/TestArrayUtil.java

diff --git a/group16/502059278/.classpath b/group16/502059278/.classpath
index fb5011632c..3e0fb272a8 100644
--- a/group16/502059278/.classpath
+++ b/group16/502059278/.classpath
@@ -2,5 +2,6 @@
 <classpath>
 	<classpathentry kind="src" path="src"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>
diff --git "a/group16/502059278/homework/\350\256\241\347\256\227\346\234\272\346\274\253\350\260\210_\344\275\234\344\270\232.docx" "b/group16/502059278/homework/\350\256\241\347\256\227\346\234\272\346\274\253\350\260\210_\344\275\234\344\270\232.docx"
deleted file mode 100644
index 31dfe4c14bd2c5980ba3209f8e697d71c800b157..0000000000000000000000000000000000000000
GIT binary patch
diff --git a/group16/502059278/src/cn/mark/MyArrayList.java b/group16/502059278/src/cn/mark/work0219/MyArrayList.java
similarity index 99%
rename from group16/502059278/src/cn/mark/MyArrayList.java
rename to group16/502059278/src/cn/mark/work0219/MyArrayList.java
index 9e0e406274..3d7a064919 100644
--- a/group16/502059278/src/cn/mark/MyArrayList.java
+++ b/group16/502059278/src/cn/mark/work0219/MyArrayList.java
@@ -1,4 +1,4 @@
-package cn.mark;
+package cn.mark.work0219;
 
 import java.util.ArrayList;
 import java.util.Arrays;
diff --git a/group16/502059278/src/cn/mark/MyLinkedList.java b/group16/502059278/src/cn/mark/work0219/MyLinkedList.java
similarity index 97%
rename from group16/502059278/src/cn/mark/MyLinkedList.java
rename to group16/502059278/src/cn/mark/work0219/MyLinkedList.java
index 7f9c3856a2..896d7bcb79 100644
--- a/group16/502059278/src/cn/mark/MyLinkedList.java
+++ b/group16/502059278/src/cn/mark/work0219/MyLinkedList.java
@@ -1,4 +1,4 @@
-package cn.mark;
+package cn.mark.work0219;
 /**
  * 自定义实现LinkedList数据结构
  * @author hilih
diff --git a/group16/502059278/src/cn/mark/MyList.java b/group16/502059278/src/cn/mark/work0219/MyList.java
similarity index 96%
rename from group16/502059278/src/cn/mark/MyList.java
rename to group16/502059278/src/cn/mark/work0219/MyList.java
index 19bc3f92fe..91f26ff8d5 100644
--- a/group16/502059278/src/cn/mark/MyList.java
+++ b/group16/502059278/src/cn/mark/work0219/MyList.java
@@ -1,4 +1,4 @@
-package cn.mark;
+package cn.mark.work0219;
 
 public interface MyList {
     /**
diff --git a/group16/502059278/src/cn/mark/work0226/ArrayUtil.java b/group16/502059278/src/cn/mark/work0226/ArrayUtil.java
new file mode 100644
index 0000000000..8ba28c330d
--- /dev/null
+++ b/group16/502059278/src/cn/mark/work0226/ArrayUtil.java
@@ -0,0 +1,130 @@
+package cn.mark.work0226;
+
+import java.util.Arrays;
+
+public class ArrayUtil {
+	
+	/**
+	 * 给定一个整形数组a , 对该数组的值进行置换
+		例如： a = [7, 9 , 30, 3]  ,   置换后为 [3, 30, 9,7]
+		如果     a = [7, 9, 30, 3, 4] , 置换后为 [4,3, 30 , 9,7]
+	 * @param origin
+	 * @return
+	 */
+	public void reverseArray(int[] origin){
+		int[] target = new int[origin.length];//声明置换后数组
+		int temp = target.length - 1;//记录置换后下标位置
+		for( int i = 0; i < origin.length; i++ ){
+			target[temp] = origin[i];
+			temp--;
+		}
+		System.out.println("置换前："+Arrays.toString(origin));
+		System.out.println("置换后："+Arrays.toString(target));
+	}
+	
+	/**
+	 * 现在有如下的一个数组：   int oldArr[]={1,3,4,5,0,0,6,6,0,5,4,7,6,7,0,5}   
+	 * 要求将以上数组中值为0的项去掉，将不为0的值存入一个新的数组，生成的新数组为：   
+	 * {1,3,4,5,6,6,5,4,7,6,7,5}  
+	 * @param oldArray
+	 * @return
+	 */
+	
+	public int[] removeZero(int[] oldArray){
+		int[] target = new int[1];
+		boolean flag = true;
+		for( int i = 0; i < oldArray.length; i++ ){
+			if ( oldArray[i] == 0 ){ // 跳过值为0的元素
+				continue;
+			}
+			
+			if ( flag ){
+				//首位赋值无需扩容
+				target[target.length-1] = oldArray[i];
+				flag = false;
+			}else{
+				//确定值不是0才能进入扩容步骤
+				target = Arrays.copyOf(target, target.length+1);
+				target[target.length-1] = oldArray[i];	
+			}
+			
+		
+			
+		}
+		System.out.println("去0前："+Arrays.toString(oldArray));
+		System.out.println("去0后："+Arrays.toString(target));
+		return target;
+	}
+	
+	/**
+	 * 给定两个已经排序好的整形数组， a1和a2 ,  创建一个新的数组a3, 使得a3 包含a1和a2 的所有元素， 并且仍然是有序的
+	 * 例如 a1 = [3, 5, 7,8]   a2 = [4, 5, 6,7]    则 a3 为[3,4,5,6,7,8]    , 注意： 已经消除了重复
+	 * @param array1
+	 * @param array2
+	 * @return
+	 */
+	
+	public int[] merge(int[] array1, int[] array2){
+		return  null;
+	}
+	/**
+	 * 把一个已经存满数据的数组 oldArray的容量进行扩展， 扩展后的新数据大小为oldArray.length + size
+	 * 注意，老数组的元素在新数组中需要保持
+	 * 例如 oldArray = [2,3,6] , size = 3,则返回的新数组为
+	 * [2,3,6,0,0,0]
+	 * @param oldArray
+	 * @param size
+	 * @return
+	 */
+	public int[] grow(int [] oldArray,  int size){
+		return null;
+	}
+	
+	/**
+	 * 斐波那契数列为：1，1，2，3，5，8，13，21......  ，给定一个最大值， 返回小于该值的数列
+	 * 例如， max = 15 , 则返回的数组应该为 [1，1，2，3，5，8，13]
+	 * max = 1, 则返回空数组 []
+	 * @param max
+	 * @return
+	 */
+	public int[] fibonacci(int max){
+		return null;
+	}
+	
+	/**
+	 * 返回小于给定最大值max的所有素数数组
+	 * 例如max = 23, 返回的数组为[2,3,5,7,11,13,17,19]
+	 * @param max
+	 * @return
+	 */
+	public int[] getPrimes(int max){
+		return null;
+	}
+	
+	/**
+	 * 所谓“完数”， 是指这个数恰好等于它的因子之和，例如6=1+2+3
+	 * 给定一个最大值max， 返回一个数组， 数组中是小于max 的所有完数
+	 * @param max
+	 * @return
+	 */
+	public int[] getPerfectNumbers(int max){
+		return null;
+	}
+	
+	/**
+	 * 用seperator 把数组 array给连接起来
+	 * 例如array= [3,8,9], seperator = "-"
+	 * 则返回值为"3-8-9"
+	 * @param array
+	 * @param s
+	 * @return
+	 */
+	public String join(int[] array, String seperator){
+		return null;
+	}
+	
+
+	public static void main(String[] args) {
+		new ArrayUtil().removeZero(new int[]{0,1,2,0,3,0,4,7,0});
+	}
+}
diff --git a/group16/502059278/src/cn/mark/work0226/TestArrayUtil.java b/group16/502059278/src/cn/mark/work0226/TestArrayUtil.java
new file mode 100644
index 0000000000..da1abd3b38
--- /dev/null
+++ b/group16/502059278/src/cn/mark/work0226/TestArrayUtil.java
@@ -0,0 +1,35 @@
+package cn.mark.work0226;
+
+import static org.junit.Assert.*;
+
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class TestArrayUtil {
+	ArrayUtil arrayUtil = null;
+	
+	@Before
+	public void setUp() throws Exception {
+		arrayUtil = new ArrayUtil();
+		
+	}
+
+	@After
+	public void tearDown() throws Exception {
+	}
+
+	@Test
+	public void reverseArray() {
+		int[] origin = new int[]{1,2,8,31};
+		arrayUtil.reverseArray(origin);
+	}
+	
+	@Test
+	public void removeZero() {
+		int[] origin = new int[]{0,1,2,0,3,0,4,7,0};
+		Assert.assertArrayEquals(new int[]{1, 2, 3, 4, 7}, arrayUtil.removeZero(origin));
+	}
+
+}

From 9d80aac9b0090f6d2d5c21e5b32fb8d4a82c7298 Mon Sep 17 00:00:00 2001
From: starlight0405 <ang505@163.com>
Date: Mon, 27 Feb 2017 17:16:25 +0800
Subject: [PATCH 09/36] first code

---
 group16/2816977791/.gitignore                 | 181 ++++++++++++++++++
 .../src/com/coding/basic/ArrayList.java       |  94 +++++++++
 .../src/com/coding/basic/BinaryTreeNode.java  |  67 +++++++
 .../src/com/coding/basic/Iterator.java        |   7 +
 .../src/com/coding/basic/LinkedList.java      | 140 ++++++++++++++
 .../src/com/coding/basic/List.java            |  13 ++
 .../src/com/coding/basic/Queue.java           |  21 ++
 .../src/com/coding/basic/Stack.java           |  25 +++
 8 files changed, 548 insertions(+)
 create mode 100644 group16/2816977791/.gitignore
 create mode 100644 group16/2816977791/firstExercise/src/com/coding/basic/ArrayList.java
 create mode 100644 group16/2816977791/firstExercise/src/com/coding/basic/BinaryTreeNode.java
 create mode 100644 group16/2816977791/firstExercise/src/com/coding/basic/Iterator.java
 create mode 100644 group16/2816977791/firstExercise/src/com/coding/basic/LinkedList.java
 create mode 100644 group16/2816977791/firstExercise/src/com/coding/basic/List.java
 create mode 100644 group16/2816977791/firstExercise/src/com/coding/basic/Queue.java
 create mode 100644 group16/2816977791/firstExercise/src/com/coding/basic/Stack.java

diff --git a/group16/2816977791/.gitignore b/group16/2816977791/.gitignore
new file mode 100644
index 0000000000..4ede1404d2
--- /dev/null
+++ b/group16/2816977791/.gitignore
@@ -0,0 +1,181 @@
+# Created by https://www.gitignore.io/api/java,intellij,eclipse,emacs,svn,maven
+
+### Java ###
+*.class
+
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+
+# Package Files #
+*.jar
+*.war
+*.ear
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+
+
+### Intellij ###
+# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
+# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
+
+# User-specific stuff:
+.idea/workspace.xml
+.idea/tasks.xml
+.idea/dictionaries
+.idea/vcs.xml
+.idea/jsLibraryMappings.xml
+*.idea
+
+# Sensitive or high-churn files:
+.idea/dataSources.ids
+.idea/dataSources.xml
+.idea/dataSources.local.xml
+.idea/sqlDataSources.xml
+.idea/dynamic.xml
+.idea/uiDesigner.xml
+
+# Gradle:
+.idea/gradle.xml
+.idea/libraries
+
+# Mongo Explorer plugin:
+.idea/mongoSettings.xml
+
+## File-based project format:
+*.iws
+
+## Plugin-specific files:
+
+# IntelliJ
+/out/
+
+# mpeltonen/sbt-idea plugin
+.idea_modules/
+
+# JIRA plugin
+atlassian-ide-plugin.xml
+
+# Crashlytics plugin (for Android Studio and IntelliJ)
+com_crashlytics_export_strings.xml
+crashlytics.properties
+crashlytics-build.properties
+fabric.properties
+
+### Intellij Patch ###
+*.iml
+
+
+### Eclipse ###
+
+.metadata
+bin/
+tmp/
+*.tmp
+*.bak
+*.swp
+*~.nib
+local.properties
+.settings/
+.loadpath
+.recommenders
+
+# Eclipse Core
+.project
+
+# External tool builders
+.externalToolBuilders/
+
+# Locally stored "Eclipse launch configurations"
+*.launch
+
+# PyDev specific (Python IDE for Eclipse)
+*.pydevproject
+
+# CDT-specific (C/C++ Development Tooling)
+.cproject
+
+# JDT-specific (Eclipse Java Development Tools)
+.classpath
+
+# Java annotation processor (APT)
+.factorypath
+
+# PDT-specific (PHP Development Tools)
+.buildpath
+
+# sbteclipse plugin
+.target
+
+# Tern plugin
+.tern-project
+
+# TeXlipse plugin
+.texlipse
+
+# STS (Spring Tool Suite)
+.springBeans
+
+# Code Recommenders
+.recommenders/
+
+
+### Emacs ###
+# -*- mode: gitignore; -*-
+*~
+\#*\#
+/.emacs.desktop
+/.emacs.desktop.lock
+*.elc
+auto-save-list
+tramp
+.\#*
+
+# Org-mode
+.org-id-locations
+*_archive
+
+# flymake-mode
+*_flymake.*
+
+# eshell files
+/eshell/history
+/eshell/lastdir
+
+# elpa packages
+/elpa/
+
+# reftex files
+*.rel
+
+# AUCTeX auto folder
+/auto/
+
+# cask packages
+.cask/
+
+# Flycheck
+flycheck_*.el
+
+# server auth directory
+/server/
+
+# projectiles files
+.projectile
+
+### SVN ###
+.svn/
+
+
+### Maven ###
+target/
+pom.xml.tag
+pom.xml.releaseBackup
+pom.xml.versionsBackup
+pom.xml.next
+release.properties
+dependency-reduced-pom.xml
+buildNumber.properties
+.mvn/timing.properties
+
+Servers/
diff --git a/group16/2816977791/firstExercise/src/com/coding/basic/ArrayList.java b/group16/2816977791/firstExercise/src/com/coding/basic/ArrayList.java
new file mode 100644
index 0000000000..7ac196b700
--- /dev/null
+++ b/group16/2816977791/firstExercise/src/com/coding/basic/ArrayList.java
@@ -0,0 +1,94 @@
+package com.coding.basic;
+
+public class ArrayList implements List {
+
+    private int size = 0;
+
+    private Object[] elementData = new Object[10];
+
+    public void add(Object o) {
+        ensureCapacity(size + 1);
+        elementData[size++] = o;
+    }
+
+    public void add(int index, Object o) {
+        checkForLength(index);
+
+        ensureCapacity(size + 1);
+        System.arraycopy(elementData, index, elementData, index + 1, size - index);
+        elementData[index] = o;
+        size++;
+    }
+
+    public Object get(int index) {
+        checkForLength(index);
+        return elementData[index];
+    }
+
+    public Object remove(int index) {
+        checkForLength(index);
+        Object oldValue = elementData[index];
+        System.arraycopy(elementData, index + 1, elementData, index, size - index - 1);
+        size--;
+        return oldValue;
+    }
+
+    public int size() {
+        return size;
+    }
+
+    public Iterator iterator() {
+        return null;
+    }
+
+    private void checkForLength(int index) {
+        if (index < 0 || index >= size) {
+            throw new RuntimeException("out of memory");
+        }
+    }
+
+    private void ensureCapacity(int minCapacity) {
+        if (minCapacity - elementData.length > 0) {
+            grow(minCapacity);
+        }
+    }
+
+    private void grow(int minCapacity) {
+        int oldCapacity = elementData.length;
+        int newCapacity = oldCapacity + (oldCapacity >> 1);//增大容量
+        if (newCapacity - minCapacity < 0) {
+            newCapacity = minCapacity;
+        }
+        elementData = copyOf(elementData, newCapacity);
+    }
+
+    private Object[] copyOf(Object[] src, int newCapacity) {
+        Object[] target = new Object[newCapacity];
+        System.arraycopy(src, 0, target, 0, src.length);
+        return target;
+    }
+
+    public static void main(String[] args) {
+        ArrayList list = new ArrayList();
+        String num = "num";
+        for (int i = 0; i < 100; i++) {
+            list.add(num + String.valueOf(i));
+            System.out.println(String.valueOf(i) + ":size:" + list.size());
+            System.out.println(String.valueOf(i) + ":length:" + list.elementData.length);
+        }
+        System.out.println(list.size());
+
+        for (int i = 0; i < 100; i++) {
+            list.add(i, num + String.valueOf(i));
+            System.out.println(String.valueOf(i) + ":size:" + list.size());
+            System.out.println(String.valueOf(i) + ":length:" + list.elementData.length);
+        }
+        System.out.println(list.size());
+
+        for (int i = 0; i < 200; i++) {
+            System.out.println(list.remove(0));
+        }
+
+        System.out.println(list.size());
+    }
+}
diff --git a/group16/2816977791/firstExercise/src/com/coding/basic/BinaryTreeNode.java b/group16/2816977791/firstExercise/src/com/coding/basic/BinaryTreeNode.java
new file mode 100644
index 0000000000..e34a68b3c2
--- /dev/null
+++ b/group16/2816977791/firstExercise/src/com/coding/basic/BinaryTreeNode.java
@@ -0,0 +1,67 @@
+package com.coding.basic;
+
+public class BinaryTreeNode {
+
+    private Object data;
+    private BinaryTreeNode left;
+    private BinaryTreeNode right;
+    private BinaryTreeNode root;
+
+    public BinaryTreeNode(Object data, BinaryTreeNode left, BinaryTreeNode right) {
+        this.data = data;
+        this.left = left;
+        this.right = right;
+    }
+
+    public Object getData() {
+        return data;
+    }
+
+    public void setData(Object data) {
+        this.data = data;
+    }
+
+    public BinaryTreeNode getLeft() {
+        return left;
+    }
+
+    public void setLeft(BinaryTreeNode left) {
+        this.left = left;
+    }
+
+    public BinaryTreeNode getRight() {
+        return right;
+    }
+
+    public void setRight(BinaryTreeNode right) {
+        this.right = right;
+    }
+
+    public BinaryTreeNode insert(Object o) {
+        BinaryTreeNode binaryTreeNode = new BinaryTreeNode(o, null, null);
+        if (root == null) {
+            root = binaryTreeNode;
+        } else {
+            add(o, root);
+        }
+        return binaryTreeNode;
+    }
+
+    private BinaryTreeNode add(Object o, BinaryTreeNode target) {
+        if (target == null) {
+            target = new BinaryTreeNode(o, null, null);
+        } else {
+            if (compare(o, target.data) > 0) {
+                target.right = add(o, target.right);
+            } else if (compare(o, target.data) < 0) {
+                target.left = add(o, target.left);
+            }
+        }
+        return target;
+    }
+
+    private int compare(Object src, Object target) {
+        return ((String) src).compareTo((String) target);
+    }
+
+}
diff --git a/group16/2816977791/firstExercise/src/com/coding/basic/Iterator.java b/group16/2816977791/firstExercise/src/com/coding/basic/Iterator.java
new file mode 100644
index 0000000000..06ef6311b2
--- /dev/null
+++ b/group16/2816977791/firstExercise/src/com/coding/basic/Iterator.java
@@ -0,0 +1,7 @@
+package com.coding.basic;
+
+public interface Iterator {
+	public boolean hasNext();
+	public Object next();
+
+}
diff --git a/group16/2816977791/firstExercise/src/com/coding/basic/LinkedList.java b/group16/2816977791/firstExercise/src/com/coding/basic/LinkedList.java
new file mode 100644
index 0000000000..be5b236700
--- /dev/null
+++ b/group16/2816977791/firstExercise/src/com/coding/basic/LinkedList.java
@@ -0,0 +1,140 @@
+package com.coding.basic;
+
+public class LinkedList implements List {
+
+    private Node head;
+    private Node last;
+
+    private int size = 0;
+
+    public void add(Object o) {
+        addLast(o);
+    }
+
+    public void add(int index, Object o) {
+        checkPosition(index);
+        if (index == size) {
+            addLast(o);
+        } else {
+            addIndex(index, o);
+        }
+    }
+
+    public Object get(int index) {
+        return node(index).data;
+    }
+
+    public Object remove(int index) {
+        checkPosition(index);
+        Object old = get(index);
+        if (index == 0) {
+            removeFirst();
+        } else if (index == size - 1) {
+            removeLast();
+        } else {
+            node(index - 1).next = node(index + 1);
+            size--;
+        }
+        return old;
+    }
+
+    public int size() {
+        return size;
+    }
+
+    public void addFirst(Object o) {
+        Node h = head;
+        Node newNode = new Node(o, h);
+        head = newNode;
+        if (h == null) {
+            last = newNode;
+        }
+        size++;
+    }
+
+    public void addLast(Object o) {
+        Node l = last;
+        Node newNode = new Node(o, null);
+        last = newNode;
+        if (l == null) {
+            head = newNode;
+        } else {
+            l.next = newNode;
+        }
+        size++;
+    }
+
+    public Object removeFirst() {
+        Node old = head;
+        head = old.next;
+        size--;
+        return old.data;
+    }
+
+    public Object removeLast() {
+        Node old = last;
+        Node prev = node(size - 2);
+        last = prev;
+        size--;
+        return old.data;
+    }
+
+    public Iterator iterator() {
+        return null;
+    }
+
+    private void checkPosition(int index) {
+        if (index < 0 || index >= size) {
+            throw new RuntimeException("out of memory");
+        }
+    }
+
+    private void addIndex(int index, Object o) {
+        checkPosition(index);
+        Node newNode = new Node(o, node(index));
+        if (index != 0) {
+            node(index - 1).next = newNode;
+        } else {
+            head = newNode;
+        }
+        size++;
+    }
+
+    private Node node(int index) {
+        Node x = head;
+        for (int i = 0; i < index; i++) {
+            x = x.next;
+        }
+        return x;
+    }
+
+    private static class Node {
+        Object data;
+        Node next;
+
+        public Node(Object data, Node next) {
+            this.data = data;
+            this.next = next;
+        }
+    }
+
+    public static void main(String[] args) {
+        LinkedList list = new LinkedList();
+        list.addLast("last");
+        System.out.println(list.size());
+        list.addFirst("head");
+        System.out.println(list.size());
+        list.add(0, "0Object");
+        System.out.println(list.size());
+        list.add(2, "2Object");
+        System.out.println(list.size());
+        list.removeLast();
+        System.out.println(list.size());
+        list.removeFirst();
+        System.out.println(list.size());
+        list.removeLast();
+        System.out.println(list.size());
+        list.get(0);
+        System.out.println(list.size());
+    }
+}
diff --git a/group16/2816977791/firstExercise/src/com/coding/basic/List.java b/group16/2816977791/firstExercise/src/com/coding/basic/List.java
new file mode 100644
index 0000000000..01398944e6
--- /dev/null
+++ b/group16/2816977791/firstExercise/src/com/coding/basic/List.java
@@ -0,0 +1,13 @@
+package com.coding.basic;
+
+public interface List {
+    public void add(Object o);
+
+    public void add(int index, Object o);
+
+    public Object get(int index);
+
+    public Object remove(int index);
+
+    public int size();
+}
diff --git a/group16/2816977791/firstExercise/src/com/coding/basic/Queue.java b/group16/2816977791/firstExercise/src/com/coding/basic/Queue.java
new file mode 100644
index 0000000000..f2475fcfd6
--- /dev/null
+++ b/group16/2816977791/firstExercise/src/com/coding/basic/Queue.java
@@ -0,0 +1,21 @@
+package com.coding.basic;
+
+public class Queue {
+    private ArrayList elementData = new ArrayList();
+
+    public void enQueue(Object o) {
+        elementData.add(o);
+    }
+
+    public Object deQueue() {
+        return elementData.get(0);
+    }
+
+    public boolean isEmpty() {
+        return elementData.size() == 0 ? true : false;
+    }
+
+    public int size() {
+        return elementData.size();
+    }
+}
diff --git a/group16/2816977791/firstExercise/src/com/coding/basic/Stack.java b/group16/2816977791/firstExercise/src/com/coding/basic/Stack.java
new file mode 100644
index 0000000000..12a89eb613
--- /dev/null
+++ b/group16/2816977791/firstExercise/src/com/coding/basic/Stack.java
@@ -0,0 +1,25 @@
+package com.coding.basic;
+
+public class Stack {
+    private ArrayList elementData = new ArrayList();
+
+    public void push(Object o) {
+        elementData.add(0, o);
+    }
+
+    public Object pop() {
+        return elementData.remove(0);
+    }
+
+    public Object peek() {
+        return elementData.get(0);
+    }
+
+    public boolean isEmpty() {
+        return elementData.size() == 0 ? true : false;
+    }
+
+    public int size() {
+        return elementData.size();
+    }
+}

From e8f81f5a95f72b465eee77cbd08805c19ba9a7f8 Mon Sep 17 00:00:00 2001
From: wanghongdi56 <313001956@qq.com>
Date: Tue, 28 Feb 2017 13:08:30 +0800
Subject: [PATCH 10/36] =?UTF-8?q?0226=E4=BD=9C=E4=B8=9A=E6=8F=90=E4=BA=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../src/com/coding/basic/ArrayList.java        | Bin 453 -> 1503 bytes
 .../src/com/coding/basic/LinkedList.java       | Bin 0 -> 2332 bytes
 .../313001956/src/com/coding/basic/Queue.java  | Bin 0 -> 413 bytes
 .../313001956/src/com/coding/basic/Stack.java  | Bin 0 -> 666 bytes
 4 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 group16/313001956/src/com/coding/basic/LinkedList.java
 create mode 100644 group16/313001956/src/com/coding/basic/Queue.java
 create mode 100644 group16/313001956/src/com/coding/basic/Stack.java

diff --git a/group16/313001956/src/com/coding/basic/ArrayList.java b/group16/313001956/src/com/coding/basic/ArrayList.java
index eaaa690fa6b76c4f36483531b915bbdd3a22c926..a6421a30fc0461adbe89407b4c18ef5a9edd6984 100644
GIT binary patch
diff --git a/group16/313001956/src/com/coding/basic/LinkedList.java b/group16/313001956/src/com/coding/basic/LinkedList.java
new file mode 100644
index 0000000000000000000000000000000000000000..f8b5e5b535dbd23a5156e04f8056229d5c140c78
GIT binary patch
diff --git a/group16/313001956/src/com/coding/basic/Queue.java b/group16/313001956/src/com/coding/basic/Queue.java
new file mode 100644
index 0000000000000000000000000000000000000000..c78249a5cf0c35c3c6052b867bd922096ac880c8
GIT binary patch
diff --git a/group16/313001956/src/com/coding/basic/Stack.java b/group16/313001956/src/com/coding/basic/Stack.java
new file mode 100644
index 0000000000000000000000000000000000000000..b849bc4b5e203e26aafb2fbd6769e53d3697f197
GIT binary patch

From c2e0b7b01d605fa899b6816d246aa7d98ccdf3f4 Mon Sep 17 00:00:00 2001
From: wanghongdi56 <313001956@qq.com>
Date: Tue, 28 Feb 2017 13:23:50 +0800
Subject: [PATCH 11/36] =?UTF-8?q?0226=E4=BD=9C=E4=B8=9A=E9=87=8D=E6=96=B0?=
 =?UTF-8?q?=E6=8F=90=E4=BA=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../src/com/coding/basic/ArrayList.java       | Bin 1503 -> 1503 bytes
 .../src/com/coding/basic/LinkedList.java      | Bin 2332 -> 2332 bytes
 .../313001956/src/com/coding/basic/Queue.java | Bin 413 -> 413 bytes
 .../313001956/src/com/coding/basic/Stack.java | Bin 666 -> 666 bytes
 4 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/group16/313001956/src/com/coding/basic/ArrayList.java b/group16/313001956/src/com/coding/basic/ArrayList.java
index a6421a30fc0461adbe89407b4c18ef5a9edd6984..3bec144013a94278e6a7ef25d65622c3430e8e27 100644
GIT binary patch
diff --git a/group16/313001956/src/com/coding/basic/LinkedList.java b/group16/313001956/src/com/coding/basic/LinkedList.java
index f8b5e5b535dbd23a5156e04f8056229d5c140c78..de886c9084ccf244f58d8a1cf62b65ce290385c0 100644
GIT binary patch
diff --git a/group16/313001956/src/com/coding/basic/Queue.java b/group16/313001956/src/com/coding/basic/Queue.java
index c78249a5cf0c35c3c6052b867bd922096ac880c8..4b9f311f99f4b68d262b2a84f225a70d7c028c39 100644
GIT binary patch
diff --git a/group16/313001956/src/com/coding/basic/Stack.java b/group16/313001956/src/com/coding/basic/Stack.java
index b849bc4b5e203e26aafb2fbd6769e53d3697f197..6ec157201e0ee3d6b149ac2a8df4b9d5c46c9775 100644
GIT binary patch

From 6135dd44b49ae63b2cf04c176e7f27e9646e845e Mon Sep 17 00:00:00 2001
From: Li Han <hiliguoxin@foxmail.com>
Date: Tue, 28 Feb 2017 16:57:44 +0800
Subject: [PATCH 12/36] =?UTF-8?q?0228Array=E4=BD=9C=E4=B8=9A=E6=8F=90?=
 =?UTF-8?q?=E4=BA=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

2.28 完成join和grow方法
---
 .../src/cn/mark/work0226/ArrayUtil.java       | 45 +++++++++++++++++--
 1 file changed, 42 insertions(+), 3 deletions(-)

diff --git a/group16/502059278/src/cn/mark/work0226/ArrayUtil.java b/group16/502059278/src/cn/mark/work0226/ArrayUtil.java
index 8ba28c330d..83ce45830f 100644
--- a/group16/502059278/src/cn/mark/work0226/ArrayUtil.java
+++ b/group16/502059278/src/cn/mark/work0226/ArrayUtil.java
@@ -20,6 +20,12 @@ public void reverseArray(int[] origin){
 		}
 		System.out.println("置换前："+Arrays.toString(origin));
 		System.out.println("置换后："+Arrays.toString(target));
+		
+		
+		 Math.random();
+		 
+		
+		
 	}
 	
 	/**
@@ -65,6 +71,27 @@ public int[] removeZero(int[] oldArray){
 	 */
 	
 	public int[] merge(int[] array1, int[] array2){
+		//1.去重
+		int[] array3 = Arrays.copyOf(array1, array1.length);
+		for( int i = 0; i < array1.length; i++ ){
+			for( int j = 0; j < array2.length ; j++ ){
+				if ( array1[i] == array2[j] ){
+					
+				}
+			}
+			
+			
+			
+			
+		}
+		
+		System.out.println(Arrays.toString(array1));
+		System.out.println(Arrays.toString(array2));
+		//2.合并
+		
+		//3.排序
+		
+		
 		return  null;
 	}
 	/**
@@ -77,7 +104,9 @@ public int[] merge(int[] array1, int[] array2){
 	 * @return
 	 */
 	public int[] grow(int [] oldArray,  int size){
-		return null;
+		int[] newArray = Arrays.copyOf(oldArray, oldArray.length+size);
+		System.out.println("扩容后："+Arrays.toString(newArray));
+		return newArray;
 	}
 	
 	/**
@@ -120,11 +149,21 @@ public int[] getPerfectNumbers(int max){
 	 * @return
 	 */
 	public String join(int[] array, String seperator){
-		return null;
+		StringBuilder sb = new StringBuilder();
+		for( int i = 0; i < array.length; i++ ){
+			if ( i == 0 ){
+				sb.append(array[i]);
+			}else{
+				sb.append(seperator+array[i]);
+			}
+		}
+		return sb.toString();
 	}
 	
 
 	public static void main(String[] args) {
-		new ArrayUtil().removeZero(new int[]{0,1,2,0,3,0,4,7,0});
+		int[] a1 =new int[]{3,8},   a2 = new int[]{4, 5, 6,7};
+		System.out.println(new ArrayUtil().join(a1, "*"));
+		
 	}
 }

From f1f965303b4a184f799e9625796d45fc07a3cec9 Mon Sep 17 00:00:00 2001
From: duxl <adu1528838@126.com>
Date: Wed, 1 Mar 2017 17:59:23 +0800
Subject: [PATCH 13/36] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E9=A1=B9?=
 =?UTF-8?q?=E7=9B=AE=E7=9A=84=E7=9B=AE=E5=BD=95=E7=BB=93=E6=9E=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../0226/src/com/coding/basic/ArrayList.java  | 126 +++++------
 .../0226/src/com/coding/basic/Iterator.java   |  12 +-
 .../0226/src/com/coding/basic/LinkedList.java | 202 +++++++++---------
 .../0226/src/com/coding/basic/List.java       |  18 +-
 .../0226/src/com/coding/basic/Queue.java      |  56 ++---
 .../0226/src/com/coding/basic/Stack.java      |  76 +++----
 6 files changed, 245 insertions(+), 245 deletions(-)

diff --git a/group16/1287642108/0226/src/com/coding/basic/ArrayList.java b/group16/1287642108/0226/src/com/coding/basic/ArrayList.java
index e287419dc0..f82d064e2a 100644
--- a/group16/1287642108/0226/src/com/coding/basic/ArrayList.java
+++ b/group16/1287642108/0226/src/com/coding/basic/ArrayList.java
@@ -1,63 +1,63 @@
-package com.coding.basic;
-
-public class ArrayList implements List {
-
-	private int size = 0;
-
-	private Object[] elementData = new Object[100];
-
-	public void add(Object o) {
-		IncrementsCapacity(size + 1);
-		elementData[size++] = o;
-
-	}
-
-	public void add(int index, Object o) {
-		checkIndex(index);
-		IncrementsCapacity(size + 1);
-		System.arraycopy(elementData, index, elementData, index + 1, size - index);
-		elementData[index] = o;
-		size++;
-	}
-
-	public Object get(int index) {
-		checkIndex(index);
-		return elementData[index];
-	}
-
-	public Object remove(int index) {
-		checkIndex(index);
-		Object o = elementData[index];
-		System.arraycopy(elementData, index + 1, elementData, index, size - index - 1);
-		elementData[--size] = null;
-		return o;
-	}
-
-	public int size() {
-		return size;
-	}
-	
-	public int length() {
-		return elementData.length;
-	}
-
-	// ����
-	private void IncrementsCapacity(int num) {
-		if (num > elementData.length) {
-			int oldCapacity = elementData.length; // ��ǰ���鳤��
-			int newCapacity = ((num + oldCapacity) * 3) >> 2; // ��ǰ���鳤�ȵ�1.5��
-			if (newCapacity - num < 0) {
-				newCapacity = num; // �����������ǲ���,ֱ����Ϊ����ֵ
-			}
-			Object[] oldelements = elementData;
-			elementData = new Object[newCapacity];
-			System.arraycopy(oldelements, 0, elementData, 0, size);
-		}
-	}
-
-	// �±�Խ���ж�
-	private void checkIndex(int index) {
-		if (index >= size || index < 0)
-			throw new IndexOutOfBoundsException("�����±�Խ��");
-	}
-}
+package com.coding.basic;
+
+public class ArrayList implements List {
+
+	private int size = 0;
+
+	private Object[] elementData = new Object[100];
+
+	public void add(Object o) {
+		IncrementsCapacity(size + 1);
+		elementData[size++] = o;
+
+	}
+
+	public void add(int index, Object o) {
+		checkIndex(index);
+		IncrementsCapacity(size + 1);
+		System.arraycopy(elementData, index, elementData, index + 1, size - index);
+		elementData[index] = o;
+		size++;
+	}
+
+	public Object get(int index) {
+		checkIndex(index);
+		return elementData[index];
+	}
+
+	public Object remove(int index) {
+		checkIndex(index);
+		Object o = elementData[index];
+		System.arraycopy(elementData, index + 1, elementData, index, size - index - 1);
+		elementData[--size] = null;
+		return o;
+	}
+
+	public int size() {
+		return size;
+	}
+	
+	public int length() {
+		return elementData.length;
+	}
+
+	// ����
+	private void IncrementsCapacity(int num) {
+		if (num > elementData.length) {
+			int oldCapacity = elementData.length; // ��ǰ���鳤��
+			int newCapacity = ((num + oldCapacity) * 3) >> 2; // ��ǰ���鳤�ȵ�1.5��
+			if (newCapacity - num < 0) {
+				newCapacity = num; // �����������ǲ���,ֱ����Ϊ����ֵ
+			}
+			Object[] oldelements = elementData;
+			elementData = new Object[newCapacity];
+			System.arraycopy(oldelements, 0, elementData, 0, size);
+		}
+	}
+
+	// �±�Խ���ж�
+	private void checkIndex(int index) {
+		if (index >= size || index < 0)
+			throw new IndexOutOfBoundsException("�����±�Խ��");
+	}
+}
diff --git a/group16/1287642108/0226/src/com/coding/basic/Iterator.java b/group16/1287642108/0226/src/com/coding/basic/Iterator.java
index e7cbd474ec..ff93e30377 100644
--- a/group16/1287642108/0226/src/com/coding/basic/Iterator.java
+++ b/group16/1287642108/0226/src/com/coding/basic/Iterator.java
@@ -1,6 +1,6 @@
-package com.coding.basic;
-
-public interface Iterator {
-	public boolean hasNext();
-	public Object next();
-}
+package com.coding.basic;
+
+public interface Iterator {
+	public boolean hasNext();
+	public Object next();
+}
diff --git a/group16/1287642108/0226/src/com/coding/basic/LinkedList.java b/group16/1287642108/0226/src/com/coding/basic/LinkedList.java
index 99c92fb9f1..fc206b4cec 100644
--- a/group16/1287642108/0226/src/com/coding/basic/LinkedList.java
+++ b/group16/1287642108/0226/src/com/coding/basic/LinkedList.java
@@ -1,101 +1,101 @@
-package com.coding.basic;
-
-public class LinkedList implements List {
-	
-	private Node head;
-	private Node tail;
-	private int size = 0 ;
-	
-	public void add(Object o){
-		addLast(o);
-	}
-
-	public void add(int index, Object o) {
-		if (index == 0) {
-			addFirst(o);
-		} else if (index >= size) {
-			addLast(o);
-		} else {
-			Node node = new Node();
-			node.data = o;
-			node.next = getNode(index);
-			getNode(index - 1).next = node;
-			size++;
-		}
-	}
-	
-	public Object get(int index) {
-		Node node = getNode(index);
-		return node.data;
-	}
-	
-	public Object remove(int index){
-		Node currentNode = getNode(index);
-		Node prevNode = getNode(index - 1);
-		Node lastNode = getNode(index + 1);
-		prevNode.next = lastNode;
-		size--;
-		return currentNode.data;
-	}
-	
-	public int size(){
-		return size;
-	}
-	
-	public void addFirst(Object o){
-		  Node node=new Node();  
-		  node.data = o;
-		  node.next = head;  
-          head = node;  
-          size++;  
-	}
-	public void addLast(Object o){
-		 Node node=new Node();  
-		 node.data = o;
-		 node.next = null; 
-         Node lastNode = getNode(size-1);
-         lastNode.next = node;
-         size++;  
-	}
-	public Object removeFirst(){
-		Object obj = getNode(0).data;
-		Node node = getNode(1);
-		node.next = head;
-		size--;
-		return obj;
-	}
-	public Object removeLast(){
-		Object obj = getNode(size - 1).data;
-		Node node = getNode(size - 2);
-		node.next = null;
-		size--;
-		return obj;
-	}
-	
-	//��ȡ�ڵ�
-    public Node getNode(int index){
-    	checkIndex(index);
-    	if(index == 0 ){
-    		return head;
-    	}else if(index == size -1 ){
-    		return tail;
-    	}else{
-    		 Node node = head;
-    	        for(int i=0;i<index;i++){
-    	        	node = node.next;
-    	        }
-    	        return node;
-    	}
-    }
-    
- // �±�Խ���ж�
- 	private void checkIndex(int index) {
- 		if (index >= size || index < 0)
- 			throw new IndexOutOfBoundsException("�����±�Խ��");
- 	}
-	
-	private static class Node {
-		Object data;
-		Node next;
-	}
-}
+package com.coding.basic;
+
+public class LinkedList implements List {
+	
+	private Node head;
+	private Node tail;
+	private int size = 0 ;
+	
+	public void add(Object o){
+		addLast(o);
+	}
+
+	public void add(int index, Object o) {
+		if (index == 0) {
+			addFirst(o);
+		} else if (index >= size) {
+			addLast(o);
+		} else {
+			Node node = new Node();
+			node.data = o;
+			node.next = getNode(index);
+			getNode(index - 1).next = node;
+			size++;
+		}
+	}
+	
+	public Object get(int index) {
+		Node node = getNode(index);
+		return node.data;
+	}
+	
+	public Object remove(int index){
+		Node currentNode = getNode(index);
+		Node prevNode = getNode(index - 1);
+		Node lastNode = getNode(index + 1);
+		prevNode.next = lastNode;
+		size--;
+		return currentNode.data;
+	}
+	
+	public int size(){
+		return size;
+	}
+	
+	public void addFirst(Object o){
+		  Node node=new Node();  
+		  node.data = o;
+		  node.next = head;  
+          head = node;  
+          size++;  
+	}
+	public void addLast(Object o){
+		 Node node=new Node();  
+		 node.data = o;
+		 node.next = null; 
+         Node lastNode = getNode(size-1);
+         lastNode.next = node;
+         size++;  
+	}
+	public Object removeFirst(){
+		Object obj = getNode(0).data;
+		Node node = getNode(1);
+		node.next = head;
+		size--;
+		return obj;
+	}
+	public Object removeLast(){
+		Object obj = getNode(size - 1).data;
+		Node node = getNode(size - 2);
+		node.next = null;
+		size--;
+		return obj;
+	}
+	
+	//��ȡ�ڵ�
+    public Node getNode(int index){
+    	checkIndex(index);
+    	if(index == 0 ){
+    		return head;
+    	}else if(index == size -1 ){
+    		return tail;
+    	}else{
+    		 Node node = head;
+    	        for(int i=0;i<index;i++){
+    	        	node = node.next;
+    	        }
+    	        return node;
+    	}
+    }
+    
+ // �±�Խ���ж�
+ 	private void checkIndex(int index) {
+ 		if (index >= size || index < 0)
+ 			throw new IndexOutOfBoundsException("�����±�Խ��");
+ 	}
+	
+	private static class Node {
+		Object data;
+		Node next;
+	}
+}
diff --git a/group16/1287642108/0226/src/com/coding/basic/List.java b/group16/1287642108/0226/src/com/coding/basic/List.java
index 10d13b5832..396b1f6416 100644
--- a/group16/1287642108/0226/src/com/coding/basic/List.java
+++ b/group16/1287642108/0226/src/com/coding/basic/List.java
@@ -1,9 +1,9 @@
-package com.coding.basic;
-
-public interface List {
-	public void add(Object o);
-	public void add(int index, Object o);
-	public Object get(int index);
-	public Object remove(int index);
-	public int size();
-}
+package com.coding.basic;
+
+public interface List {
+	public void add(Object o);
+	public void add(int index, Object o);
+	public Object get(int index);
+	public Object remove(int index);
+	public int size();
+}
diff --git a/group16/1287642108/0226/src/com/coding/basic/Queue.java b/group16/1287642108/0226/src/com/coding/basic/Queue.java
index 95dee3d81b..418e42826e 100644
--- a/group16/1287642108/0226/src/com/coding/basic/Queue.java
+++ b/group16/1287642108/0226/src/com/coding/basic/Queue.java
@@ -1,28 +1,28 @@
-package com.coding.basic;
-
-public class Queue {
-	private LinkedList elementData = new LinkedList();
-
-	public void enQueue(Object o){		
-		elementData.addLast(o);
-	}
-	
-	public Object deQueue(){
-		if (isEmpty()) {
-			return null;
-		}else{
-			return elementData.removeFirst();
-		}
-	}
-	
-	public boolean isEmpty(){
-		if (elementData.size() == 0) {
-			return true;
-		}
-		return false;
-	}
-	
-	public int size(){
-		return elementData.size();
-	}
-}
+package com.coding.basic;
+
+public class Queue {
+	private LinkedList elementData = new LinkedList();
+
+	public void enQueue(Object o){		
+		elementData.addLast(o);
+	}
+	
+	public Object deQueue(){
+		if (isEmpty()) {
+			return null;
+		}else{
+			return elementData.removeFirst();
+		}
+	}
+	
+	public boolean isEmpty(){
+		if (elementData.size() == 0) {
+			return true;
+		}
+		return false;
+	}
+	
+	public int size(){
+		return elementData.size();
+	}
+}
diff --git a/group16/1287642108/0226/src/com/coding/basic/Stack.java b/group16/1287642108/0226/src/com/coding/basic/Stack.java
index c0b7da89f8..6138bc6973 100644
--- a/group16/1287642108/0226/src/com/coding/basic/Stack.java
+++ b/group16/1287642108/0226/src/com/coding/basic/Stack.java
@@ -1,38 +1,38 @@
-package com.coding.basic;
-
-public class Stack {
-	private ArrayList elementData = new ArrayList();
-
-	public void push(Object o) {
-		if (isEmpty()) {
-			elementData.add(elementData.length() - 1, o);
-		}
-		elementData.add(elementData.length() - elementData.size() - 1, o);
-	}
-
-	public Object pop() {
-		if (isEmpty()) {
-			return null;
-		}
-		return elementData.remove(elementData.length() - elementData.size() - 1);
-	}
-
-	public Object peek() {
-		if (isEmpty()) {
-			return null;
-		}
-		return elementData.get(elementData.length() - elementData.size() - 1);
-	}
-
-	public boolean isEmpty() {
-		if (elementData.size() == 0) {
-			return true;
-		}
-		return false;
-	}
-
-	public int size() {
-		return elementData.size();
-	}
-
-}
+package com.coding.basic;
+
+public class Stack {
+	private ArrayList elementData = new ArrayList();
+
+	public void push(Object o) {
+		if (isEmpty()) {
+			elementData.add(elementData.length() - 1, o);
+		}
+		elementData.add(elementData.length() - elementData.size() - 1, o);
+	}
+
+	public Object pop() {
+		if (isEmpty()) {
+			return null;
+		}
+		return elementData.remove(elementData.length() - elementData.size() - 1);
+	}
+
+	public Object peek() {
+		if (isEmpty()) {
+			return null;
+		}
+		return elementData.get(elementData.length() - elementData.size() - 1);
+	}
+
+	public boolean isEmpty() {
+		if (elementData.size() == 0) {
+			return true;
+		}
+		return false;
+	}
+
+	public int size() {
+		return elementData.size();
+	}
+
+}

From 314dd5c449f2ef60832fb04a33906f01a66fa165 Mon Sep 17 00:00:00 2001
From: duxl <adu1528838@126.com>
Date: Wed, 1 Mar 2017 18:00:24 +0800
Subject: [PATCH 14/36] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E7=9B=AE?=
 =?UTF-8?q?=E5=BD=95=E7=BB=93=E6=9E=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../src/com/coderising/array/ArrayUtil.java   | 96 +++++++++++++++++++
 .../coderising/litestruts/LoginAction.java    | 39 ++++++++
 .../src/com/coderising/litestruts/Struts.java | 34 +++++++
 .../com/coderising/litestruts/StrutsTest.java | 43 +++++++++
 .../src/com/coderising/litestruts/View.java   | 23 +++++
 .../src/com/coderising/litestruts/struts.xml  | 11 +++
 6 files changed, 246 insertions(+)
 create mode 100644 group16/1287642108/0305/src/com/coderising/array/ArrayUtil.java
 create mode 100644 group16/1287642108/0305/src/com/coderising/litestruts/LoginAction.java
 create mode 100644 group16/1287642108/0305/src/com/coderising/litestruts/Struts.java
 create mode 100644 group16/1287642108/0305/src/com/coderising/litestruts/StrutsTest.java
 create mode 100644 group16/1287642108/0305/src/com/coderising/litestruts/View.java
 create mode 100644 group16/1287642108/0305/src/com/coderising/litestruts/struts.xml

diff --git a/group16/1287642108/0305/src/com/coderising/array/ArrayUtil.java b/group16/1287642108/0305/src/com/coderising/array/ArrayUtil.java
new file mode 100644
index 0000000000..78845d06d0
--- /dev/null
+++ b/group16/1287642108/0305/src/com/coderising/array/ArrayUtil.java
@@ -0,0 +1,96 @@
+package com.coderising.array;
+
+public class ArrayUtil {
+	
+	/**
+	 * 给定一个整形数组a , 对该数组的值进行置换
+		例如： a = [7, 9 , 30, 3]  ,   置换后为 [3, 30, 9,7]
+		如果     a = [7, 9, 30, 3, 4] , 置换后为 [4,3, 30 , 9,7]
+	 * @param origin
+	 * @return
+	 */
+	public void reverseArray(int[] origin){
+		
+	}
+	
+	/**
+	 * 现在有如下的一个数组：   int oldArr[]={1,3,4,5,0,0,6,6,0,5,4,7,6,7,0,5}   
+	 * 要求将以上数组中值为0的项去掉，将不为0的值存入一个新的数组，生成的新数组为：   
+	 * {1,3,4,5,6,6,5,4,7,6,7,5}  
+	 * @param oldArray
+	 * @return
+	 */
+	
+	public int[] removeZero(int[] oldArray){
+		return null;
+	}
+	
+	/**
+	 * 给定两个已经排序好的整形数组， a1和a2 ,  创建一个新的数组a3, 使得a3 包含a1和a2 的所有元素， 并且仍然是有序的
+	 * 例如 a1 = [3, 5, 7,8]   a2 = [4, 5, 6,7]    则 a3 为[3,4,5,6,7,8]    , 注意： 已经消除了重复
+	 * @param array1
+	 * @param array2
+	 * @return
+	 */
+	
+	public int[] merge(int[] array1, int[] array2){
+		return  null;
+	}
+	/**
+	 * 把一个已经存满数据的数组 oldArray的容量进行扩展， 扩展后的新数据大小为oldArray.length + size
+	 * 注意，老数组的元素在新数组中需要保持
+	 * 例如 oldArray = [2,3,6] , size = 3,则返回的新数组为
+	 * [2,3,6,0,0,0]
+	 * @param oldArray
+	 * @param size
+	 * @return
+	 */
+	public int[] grow(int [] oldArray,  int size){
+		return null;
+	}
+	
+	/**
+	 * 斐波那契数列为：1，1，2，3，5，8，13，21......  ，给定一个最大值， 返回小于该值的数列
+	 * 例如， max = 15 , 则返回的数组应该为 [1，1，2，3，5，8，13]
+	 * max = 1, 则返回空数组 []
+	 * @param max
+	 * @return
+	 */
+	public int[] fibonacci(int max){
+		return null;
+	}
+	
+	/**
+	 * 返回小于给定最大值max的所有素数数组
+	 * 例如max = 23, 返回的数组为[2,3,5,7,11,13,17,19]
+	 * @param max
+	 * @return
+	 */
+	public int[] getPrimes(int max){
+		return null;
+	}
+	
+	/**
+	 * 所谓“完数”， 是指这个数恰好等于它的因子之和，例如6=1+2+3
+	 * 给定一个最大值max， 返回一个数组， 数组中是小于max 的所有完数
+	 * @param max
+	 * @return
+	 */
+	public int[] getPerfectNumbers(int max){
+		return null;
+	}
+	
+	/**
+	 * 用seperator 把数组 array给连接起来
+	 * 例如array= [3,8,9], seperator = "-"
+	 * 则返回值为"3-8-9"
+	 * @param array
+	 * @param s
+	 * @return
+	 */
+	public String join(int[] array, String seperator){
+		return null;
+	}
+	
+
+}
diff --git a/group16/1287642108/0305/src/com/coderising/litestruts/LoginAction.java b/group16/1287642108/0305/src/com/coderising/litestruts/LoginAction.java
new file mode 100644
index 0000000000..1005f35a29
--- /dev/null
+++ b/group16/1287642108/0305/src/com/coderising/litestruts/LoginAction.java
@@ -0,0 +1,39 @@
+package com.coderising.litestruts;
+
+/**
+ * 这是一个用来展示登录的业务类， 其中的用户名和密码都是硬编码的。
+ * @author liuxin
+ *
+ */
+public class LoginAction{
+    private String name ;
+    private String password;
+    private String message;
+
+    public String getName() {
+        return name;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public String execute(){
+            if("test".equals(name) && "1234".equals(password)){
+                this.message = "login successful";
+                return "success";
+            }
+            this.message = "login failed,please check your user/pwd";
+            return "fail";
+    }
+
+    public void setName(String name){
+        this.name = name;
+    }
+    public void setPassword(String password){
+        this.password = password;
+    }
+    public String getMessage(){
+        return this.message;
+    }
+}
diff --git a/group16/1287642108/0305/src/com/coderising/litestruts/Struts.java b/group16/1287642108/0305/src/com/coderising/litestruts/Struts.java
new file mode 100644
index 0000000000..44cc35bf01
--- /dev/null
+++ b/group16/1287642108/0305/src/com/coderising/litestruts/Struts.java
@@ -0,0 +1,34 @@
+package com.coderising.litestruts;
+
+import java.util.Map;
+
+
+
+public class Struts {
+
+    public static View runAction(String actionName, Map<String,String> parameters) {
+
+        /*
+         
+		0. 读取配置文件struts.xml
+ 		
+ 		1. 根据actionName找到相对应的class ， 例如LoginAction,   通过反射实例化（创建对象）
+		据parameters中的数据，调用对象的setter方法， 例如parameters中的数据是 
+		("name"="test" ,  "password"="1234") ,     	
+		那就应该调用 setName和setPassword方法
+		
+		2. 通过反射调用对象的exectue 方法， 并获得返回值，例如"success"
+		
+		3. 通过反射找到对象的所有getter方法（例如 getMessage）,  
+		通过反射来调用， 把值和属性形成一个HashMap , 例如 {"message":  "登录成功"} ,  
+		放到View对象的parameters
+		
+		4. 根据struts.xml中的 <result> 配置,以及execute的返回值，  确定哪一个jsp，  
+		放到View对象的jsp字段中。
+        
+        */
+    	
+    	return null;
+    }    
+
+}
diff --git a/group16/1287642108/0305/src/com/coderising/litestruts/StrutsTest.java b/group16/1287642108/0305/src/com/coderising/litestruts/StrutsTest.java
new file mode 100644
index 0000000000..a44c1878ac
--- /dev/null
+++ b/group16/1287642108/0305/src/com/coderising/litestruts/StrutsTest.java
@@ -0,0 +1,43 @@
+package com.coderising.litestruts;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+
+
+
+
+public class StrutsTest {
+
+	@Test
+	public void testLoginActionSuccess() {
+		
+		String actionName = "login";
+        
+		Map<String,String> params = new HashMap<String,String>();
+        params.put("name","test");
+        params.put("password","1234");
+        
+        
+        View view  = Struts.runAction(actionName,params);        
+        
+        Assert.assertEquals("/jsp/homepage.jsp", view.getJsp());
+        Assert.assertEquals("login successful", view.getParameters().get("message"));
+	}
+
+	@Test
+	public void testLoginActionFailed() {
+		String actionName = "login";
+		Map<String,String> params = new HashMap<String,String>();
+        params.put("name","test");
+        params.put("password","123456"); //密码和预设的不一致
+        
+        View view  = Struts.runAction(actionName,params);        
+        
+        Assert.assertEquals("/jsp/showLogin.jsp", view.getJsp());
+        Assert.assertEquals("login failed,please check your user/pwd", view.getParameters().get("message"));
+	}
+}
diff --git a/group16/1287642108/0305/src/com/coderising/litestruts/View.java b/group16/1287642108/0305/src/com/coderising/litestruts/View.java
new file mode 100644
index 0000000000..0194c681f6
--- /dev/null
+++ b/group16/1287642108/0305/src/com/coderising/litestruts/View.java
@@ -0,0 +1,23 @@
+package com.coderising.litestruts;
+
+import java.util.Map;
+
+public class View {
+	private String jsp;
+	private Map parameters;
+	
+	public String getJsp() {
+		return jsp;
+	}
+	public View setJsp(String jsp) {
+		this.jsp = jsp;
+		return this;
+	}
+	public Map getParameters() {
+		return parameters;
+	}
+	public View setParameters(Map parameters) {
+		this.parameters = parameters;
+		return this;
+	}
+}
diff --git a/group16/1287642108/0305/src/com/coderising/litestruts/struts.xml b/group16/1287642108/0305/src/com/coderising/litestruts/struts.xml
new file mode 100644
index 0000000000..99063bcb0c
--- /dev/null
+++ b/group16/1287642108/0305/src/com/coderising/litestruts/struts.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<struts>
+    <action name="login" class="com.coderising.action.LoginAction">
+        <result name="success">/jsp/homepage.jsp</result>
+        <result name="fail">/jsp/showLogin.jsp</result>
+    </action>
+    <action name="logout" class="com.coderising.action.LogoutAction">
+    	<result = "success">/jsp/welcome.jsp</result>
+    	<result = "error">/jsp/error.jsp</result>
+    </action>
+</struts>
\ No newline at end of file

From 97d68681e416f5757fd6a69ccbf8d219dd088a55 Mon Sep 17 00:00:00 2001
From: shane <baohua.shan@zhulebei.com>
Date: Wed, 1 Mar 2017 19:33:30 +0800
Subject: [PATCH 15/36] get homework

---
 .../src/com/coderising/array/ArrayUtil.java   | 96 +++++++++++++++++++
 .../coderising/litestruts/LoginAction.java    | 39 ++++++++
 .../src/com/coderising/litestruts/Struts.java | 34 +++++++
 .../com/coderising/litestruts/StrutsTest.java | 43 +++++++++
 .../src/com/coderising/litestruts/View.java   | 23 +++++
 .../src/com/coderising/litestruts/struts.xml  | 11 +++
 group16/214074094/src/com/reading/blog.txt    |  1 +
 .../214074094/src/com/reading/blog_test.txt   |  1 -
 8 files changed, 247 insertions(+), 1 deletion(-)
 create mode 100644 group16/214074094/src/com/coderising/array/ArrayUtil.java
 create mode 100644 group16/214074094/src/com/coderising/litestruts/LoginAction.java
 create mode 100644 group16/214074094/src/com/coderising/litestruts/Struts.java
 create mode 100644 group16/214074094/src/com/coderising/litestruts/StrutsTest.java
 create mode 100644 group16/214074094/src/com/coderising/litestruts/View.java
 create mode 100644 group16/214074094/src/com/coderising/litestruts/struts.xml
 create mode 100644 group16/214074094/src/com/reading/blog.txt
 delete mode 100644 group16/214074094/src/com/reading/blog_test.txt

diff --git a/group16/214074094/src/com/coderising/array/ArrayUtil.java b/group16/214074094/src/com/coderising/array/ArrayUtil.java
new file mode 100644
index 0000000000..8d8ea095ce
--- /dev/null
+++ b/group16/214074094/src/com/coderising/array/ArrayUtil.java
@@ -0,0 +1,96 @@
+package coderising.array;
+
+public class ArrayUtil {
+	
+	/**
+	 * 给定一个整形数组a , 对该数组的值进行置换
+		例如： a = [7, 9 , 30, 3]  ,   置换后为 [3, 30, 9,7]
+		如果     a = [7, 9, 30, 3, 4] , 置换后为 [4,3, 30 , 9,7]
+	 * @param origin
+	 * @return
+	 */
+	public void reverseArray(int[] origin){
+		
+	}
+	
+	/**
+	 * 现在有如下的一个数组：   int oldArr[]={1,3,4,5,0,0,6,6,0,5,4,7,6,7,0,5}   
+	 * 要求将以上数组中值为0的项去掉，将不为0的值存入一个新的数组，生成的新数组为：   
+	 * {1,3,4,5,6,6,5,4,7,6,7,5}  
+	 * @param oldArray
+	 * @return
+	 */
+	
+	public int[] removeZero(int[] oldArray){
+		return null;
+	}
+	
+	/**
+	 * 给定两个已经排序好的整形数组， a1和a2 ,  创建一个新的数组a3, 使得a3 包含a1和a2 的所有元素， 并且仍然是有序的
+	 * 例如 a1 = [3, 5, 7,8]   a2 = [4, 5, 6,7]    则 a3 为[3,4,5,6,7,8]    , 注意： 已经消除了重复
+	 * @param array1
+	 * @param array2
+	 * @return
+	 */
+	
+	public int[] merge(int[] array1, int[] array2){
+		return  null;
+	}
+	/**
+	 * 把一个已经存满数据的数组 oldArray的容量进行扩展， 扩展后的新数据大小为oldArray.length + size
+	 * 注意，老数组的元素在新数组中需要保持
+	 * 例如 oldArray = [2,3,6] , size = 3,则返回的新数组为
+	 * [2,3,6,0,0,0]
+	 * @param oldArray
+	 * @param size
+	 * @return
+	 */
+	public int[] grow(int [] oldArray,  int size){
+		return null;
+	}
+	
+	/**
+	 * 斐波那契数列为：1，1，2，3，5，8，13，21......  ，给定一个最大值， 返回小于该值的数列
+	 * 例如， max = 15 , 则返回的数组应该为 [1，1，2，3，5，8，13]
+	 * max = 1, 则返回空数组 []
+	 * @param max
+	 * @return
+	 */
+	public int[] fibonacci(int max){
+		return null;
+	}
+	
+	/**
+	 * 返回小于给定最大值max的所有素数数组
+	 * 例如max = 23, 返回的数组为[2,3,5,7,11,13,17,19]
+	 * @param max
+	 * @return
+	 */
+	public int[] getPrimes(int max){
+		return null;
+	}
+	
+	/**
+	 * 所谓“完数”， 是指这个数恰好等于它的因子之和，例如6=1+2+3
+	 * 给定一个最大值max， 返回一个数组， 数组中是小于max 的所有完数
+	 * @param max
+	 * @return
+	 */
+	public int[] getPerfectNumbers(int max){
+		return null;
+	}
+	
+	/**
+	 * 用seperator 把数组 array给连接起来
+	 * 例如array= [3,8,9], seperator = "-"
+	 * 则返回值为"3-8-9"
+	 * @param array
+	 * @param s
+	 * @return
+	 */
+	public String join(int[] array, String seperator){
+		return null;
+	}
+	
+
+}
diff --git a/group16/214074094/src/com/coderising/litestruts/LoginAction.java b/group16/214074094/src/com/coderising/litestruts/LoginAction.java
new file mode 100644
index 0000000000..66b34536c7
--- /dev/null
+++ b/group16/214074094/src/com/coderising/litestruts/LoginAction.java
@@ -0,0 +1,39 @@
+package coderising.litestruts;
+
+/**
+ * 这是一个用来展示登录的业务类， 其中的用户名和密码都是硬编码的。
+ * @author liuxin
+ *
+ */
+public class LoginAction{
+    private String name ;
+    private String password;
+    private String message;
+
+    public String getName() {
+        return name;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public String execute(){
+            if("test".equals(name) && "1234".equals(password)){
+                this.message = "login successful";
+                return "success";
+            }
+            this.message = "login failed,please check your user/pwd";
+            return "fail";
+    }
+
+    public void setName(String name){
+        this.name = name;
+    }
+    public void setPassword(String password){
+        this.password = password;
+    }
+    public String getMessage(){
+        return this.message;
+    }
+}
diff --git a/group16/214074094/src/com/coderising/litestruts/Struts.java b/group16/214074094/src/com/coderising/litestruts/Struts.java
new file mode 100644
index 0000000000..5a58101617
--- /dev/null
+++ b/group16/214074094/src/com/coderising/litestruts/Struts.java
@@ -0,0 +1,34 @@
+package coderising.litestruts;
+
+import java.util.Map;
+
+
+
+public class Struts {
+
+    public static View runAction(String actionName, Map<String,String> parameters) {
+
+        /*
+         
+		0. 读取配置文件struts.xml
+ 		
+ 		1. 根据actionName找到相对应的class ， 例如LoginAction,   通过反射实例化（创建对象）
+		据parameters中的数据，调用对象的setter方法， 例如parameters中的数据是 
+		("name"="test" ,  "password"="1234") ,     	
+		那就应该调用 setName和setPassword方法
+		
+		2. 通过反射调用对象的exectue 方法， 并获得返回值，例如"success"
+		
+		3. 通过反射找到对象的所有getter方法（例如 getMessage）,  
+		通过反射来调用， 把值和属性形成一个HashMap , 例如 {"message":  "登录成功"} ,  
+		放到View对象的parameters
+		
+		4. 根据struts.xml中的 <result> 配置,以及execute的返回值，  确定哪一个jsp，  
+		放到View对象的jsp字段中。
+        
+        */
+    	
+    	return null;
+    }    
+
+}
diff --git a/group16/214074094/src/com/coderising/litestruts/StrutsTest.java b/group16/214074094/src/com/coderising/litestruts/StrutsTest.java
new file mode 100644
index 0000000000..057dd200b9
--- /dev/null
+++ b/group16/214074094/src/com/coderising/litestruts/StrutsTest.java
@@ -0,0 +1,43 @@
+package coderising.litestruts;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+
+
+
+
+public class StrutsTest {
+
+	@Test
+	public void testLoginActionSuccess() {
+		
+		String actionName = "login";
+        
+		Map<String,String> params = new HashMap<String,String>();
+        params.put("name","test");
+        params.put("password","1234");
+        
+        
+        View view  = Struts.runAction(actionName,params);        
+        
+        Assert.assertEquals("/jsp/homepage.jsp", view.getJsp());
+        Assert.assertEquals("login successful", view.getParameters().get("message"));
+	}
+
+	@Test
+	public void testLoginActionFailed() {
+		String actionName = "login";
+		Map<String,String> params = new HashMap<String,String>();
+        params.put("name","test");
+        params.put("password","123456"); //密码和预设的不一致
+        
+        View view  = Struts.runAction(actionName,params);        
+        
+        Assert.assertEquals("/jsp/showLogin.jsp", view.getJsp());
+        Assert.assertEquals("login failed,please check your user/pwd", view.getParameters().get("message"));
+	}
+}
diff --git a/group16/214074094/src/com/coderising/litestruts/View.java b/group16/214074094/src/com/coderising/litestruts/View.java
new file mode 100644
index 0000000000..9b984eaedb
--- /dev/null
+++ b/group16/214074094/src/com/coderising/litestruts/View.java
@@ -0,0 +1,23 @@
+package coderising.litestruts;
+
+import java.util.Map;
+
+public class View {
+	private String jsp;
+	private Map parameters;
+	
+	public String getJsp() {
+		return jsp;
+	}
+	public View setJsp(String jsp) {
+		this.jsp = jsp;
+		return this;
+	}
+	public Map getParameters() {
+		return parameters;
+	}
+	public View setParameters(Map parameters) {
+		this.parameters = parameters;
+		return this;
+	}
+}
diff --git a/group16/214074094/src/com/coderising/litestruts/struts.xml b/group16/214074094/src/com/coderising/litestruts/struts.xml
new file mode 100644
index 0000000000..99063bcb0c
--- /dev/null
+++ b/group16/214074094/src/com/coderising/litestruts/struts.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<struts>
+    <action name="login" class="com.coderising.action.LoginAction">
+        <result name="success">/jsp/homepage.jsp</result>
+        <result name="fail">/jsp/showLogin.jsp</result>
+    </action>
+    <action name="logout" class="com.coderising.action.LogoutAction">
+    	<result = "success">/jsp/welcome.jsp</result>
+    	<result = "error">/jsp/error.jsp</result>
+    </action>
+</struts>
\ No newline at end of file
diff --git a/group16/214074094/src/com/reading/blog.txt b/group16/214074094/src/com/reading/blog.txt
new file mode 100644
index 0000000000..f112f8ea6a
--- /dev/null
+++ b/group16/214074094/src/com/reading/blog.txt
@@ -0,0 +1 @@
+学习-CPU、内存、硬盘、指令及它们之间的关系:　https://stevenshane.github.io/study/2017/02/27/coding2017-reading.html
\ No newline at end of file
diff --git a/group16/214074094/src/com/reading/blog_test.txt b/group16/214074094/src/com/reading/blog_test.txt
deleted file mode 100644
index b7e5cbfe14..0000000000
--- a/group16/214074094/src/com/reading/blog_test.txt
+++ /dev/null
@@ -1 +0,0 @@
-just test new fork
\ No newline at end of file

From dc66d7191165f607570b2a8b1308511adf4d076a Mon Sep 17 00:00:00 2001
From: shane <baohua.shan@zhulebei.com>
Date: Wed, 1 Mar 2017 20:28:05 +0800
Subject: [PATCH 16/36] =?UTF-8?q?=E9=87=8D=E6=9E=84=E9=A1=B9=E7=9B=AE?=
 =?UTF-8?q?=E7=9B=AE=E5=BD=95=E3=80=81=E6=B7=BB=E5=8A=A0blog=E5=9C=B0?=
 =?UTF-8?q?=E5=9D=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../src/com/coderising/array/ArrayUtil.java   |  96 --------------
 .../study/coderising/array/ArrayUtil.java     | 125 ++++++++++++++++++
 .../coderising/litestruts/LoginAction.java    |   2 +-
 .../study}/coderising/litestruts/Struts.java  |   2 +-
 .../coderising/litestruts/StrutsTest.java     |   2 +-
 .../study}/coderising/litestruts/View.java    |   2 +-
 .../study}/coderising/litestruts/struts.xml   |   0
 .../java/study}/coding/basic/ArrayList.java   |   2 +-
 .../study}/coding/basic/BinaryTreeNode.java   |   2 +-
 .../java/study}/coding/basic/Iterator.java    |   2 +-
 .../java/study}/coding/basic/LinkedList.java  |   2 +-
 .../java/study}/coding/basic/List.java        |   2 +-
 .../java/study}/coding/basic/Queue.java       |   2 +-
 .../java/study}/coding/basic/Stack.java       |   2 +-
 .../{com => main/java/study}/reading/blog.txt |   0
 .../basic => java/study}/AbstractTest.java    |   2 +-
 .../study}/coding/basic/ArrayListTest.java    |   3 +-
 .../coding/basic/BinaryTreeNodeTest.java      |   3 +-
 .../study}/coding/basic/LinkedListTest.java   |   3 +-
 .../study}/coding/basic/QueueTest.java        |   3 +-
 .../study}/coding/basic/StackTest.java        |   3 +-
 21 files changed, 147 insertions(+), 113 deletions(-)
 delete mode 100644 group16/214074094/src/com/coderising/array/ArrayUtil.java
 create mode 100644 group16/214074094/src/main/java/study/coderising/array/ArrayUtil.java
 rename group16/214074094/src/{com => main/java/study}/coderising/litestruts/LoginAction.java (92%)
 rename group16/214074094/src/{com => main/java/study}/coderising/litestruts/Struts.java (93%)
 rename group16/214074094/src/{com => main/java/study}/coderising/litestruts/StrutsTest.java (93%)
 rename group16/214074094/src/{com => main/java/study}/coderising/litestruts/View.java (85%)
 rename group16/214074094/src/{com => main/java/study}/coderising/litestruts/struts.xml (100%)
 rename group16/214074094/src/{com => main/java/study}/coding/basic/ArrayList.java (99%)
 rename group16/214074094/src/{com => main/java/study}/coding/basic/BinaryTreeNode.java (98%)
 rename group16/214074094/src/{com => main/java/study}/coding/basic/Iterator.java (73%)
 rename group16/214074094/src/{com => main/java/study}/coding/basic/LinkedList.java (99%)
 rename group16/214074094/src/{com => main/java/study}/coding/basic/List.java (85%)
 rename group16/214074094/src/{com => main/java/study}/coding/basic/Queue.java (95%)
 rename group16/214074094/src/{com => main/java/study}/coding/basic/Stack.java (95%)
 rename group16/214074094/src/{com => main/java/study}/reading/blog.txt (100%)
 rename group16/214074094/src/test/{coding/basic => java/study}/AbstractTest.java (95%)
 rename group16/214074094/src/test/{ => java/study}/coding/basic/ArrayListTest.java (96%)
 rename group16/214074094/src/test/{ => java/study}/coding/basic/BinaryTreeNodeTest.java (92%)
 rename group16/214074094/src/test/{ => java/study}/coding/basic/LinkedListTest.java (96%)
 rename group16/214074094/src/test/{ => java/study}/coding/basic/QueueTest.java (95%)
 rename group16/214074094/src/test/{ => java/study}/coding/basic/StackTest.java (95%)

diff --git a/group16/214074094/src/com/coderising/array/ArrayUtil.java b/group16/214074094/src/com/coderising/array/ArrayUtil.java
deleted file mode 100644
index 8d8ea095ce..0000000000
--- a/group16/214074094/src/com/coderising/array/ArrayUtil.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package coderising.array;
-
-public class ArrayUtil {
-	
-	/**
-	 * 给定一个整形数组a , 对该数组的值进行置换
-		例如： a = [7, 9 , 30, 3]  ,   置换后为 [3, 30, 9,7]
-		如果     a = [7, 9, 30, 3, 4] , 置换后为 [4,3, 30 , 9,7]
-	 * @param origin
-	 * @return
-	 */
-	public void reverseArray(int[] origin){
-		
-	}
-	
-	/**
-	 * 现在有如下的一个数组：   int oldArr[]={1,3,4,5,0,0,6,6,0,5,4,7,6,7,0,5}   
-	 * 要求将以上数组中值为0的项去掉，将不为0的值存入一个新的数组，生成的新数组为：   
-	 * {1,3,4,5,6,6,5,4,7,6,7,5}  
-	 * @param oldArray
-	 * @return
-	 */
-	
-	public int[] removeZero(int[] oldArray){
-		return null;
-	}
-	
-	/**
-	 * 给定两个已经排序好的整形数组， a1和a2 ,  创建一个新的数组a3, 使得a3 包含a1和a2 的所有元素， 并且仍然是有序的
-	 * 例如 a1 = [3, 5, 7,8]   a2 = [4, 5, 6,7]    则 a3 为[3,4,5,6,7,8]    , 注意： 已经消除了重复
-	 * @param array1
-	 * @param array2
-	 * @return
-	 */
-	
-	public int[] merge(int[] array1, int[] array2){
-		return  null;
-	}
-	/**
-	 * 把一个已经存满数据的数组 oldArray的容量进行扩展， 扩展后的新数据大小为oldArray.length + size
-	 * 注意，老数组的元素在新数组中需要保持
-	 * 例如 oldArray = [2,3,6] , size = 3,则返回的新数组为
-	 * [2,3,6,0,0,0]
-	 * @param oldArray
-	 * @param size
-	 * @return
-	 */
-	public int[] grow(int [] oldArray,  int size){
-		return null;
-	}
-	
-	/**
-	 * 斐波那契数列为：1，1，2，3，5，8，13，21......  ，给定一个最大值， 返回小于该值的数列
-	 * 例如， max = 15 , 则返回的数组应该为 [1，1，2，3，5，8，13]
-	 * max = 1, 则返回空数组 []
-	 * @param max
-	 * @return
-	 */
-	public int[] fibonacci(int max){
-		return null;
-	}
-	
-	/**
-	 * 返回小于给定最大值max的所有素数数组
-	 * 例如max = 23, 返回的数组为[2,3,5,7,11,13,17,19]
-	 * @param max
-	 * @return
-	 */
-	public int[] getPrimes(int max){
-		return null;
-	}
-	
-	/**
-	 * 所谓“完数”， 是指这个数恰好等于它的因子之和，例如6=1+2+3
-	 * 给定一个最大值max， 返回一个数组， 数组中是小于max 的所有完数
-	 * @param max
-	 * @return
-	 */
-	public int[] getPerfectNumbers(int max){
-		return null;
-	}
-	
-	/**
-	 * 用seperator 把数组 array给连接起来
-	 * 例如array= [3,8,9], seperator = "-"
-	 * 则返回值为"3-8-9"
-	 * @param array
-	 * @param s
-	 * @return
-	 */
-	public String join(int[] array, String seperator){
-		return null;
-	}
-	
-
-}
diff --git a/group16/214074094/src/main/java/study/coderising/array/ArrayUtil.java b/group16/214074094/src/main/java/study/coderising/array/ArrayUtil.java
new file mode 100644
index 0000000000..01061195b2
--- /dev/null
+++ b/group16/214074094/src/main/java/study/coderising/array/ArrayUtil.java
@@ -0,0 +1,125 @@
+package study.coderising.array;
+
+import com.alibaba.fastjson.JSON;
+
+public class ArrayUtil {
+
+    /**
+     * 给定一个整形数组a , 对该数组的值进行置换
+     * 例如： a = [7, 9 , 30, 3]  ,   置换后为 [3, 30, 9,7]
+     * 如果     a = [7, 9, 30, 3, 4] , 置换后为 [4,3, 30 , 9,7]
+     *
+     * @param origin
+     * @return
+     */
+    public void reverseArray(int[] origin) {
+        int tmp = 0;
+        int len = origin.length;
+        int middle = len / 2;
+        for (int i = 0; i < middle; i++) {
+            tmp = origin[i];
+            origin[i] = origin[len - i - 1];
+            origin[len - i - 1] = tmp;
+        }
+    }
+
+
+
+    public static void main(String[] args) {
+        ArrayUtil util = new ArrayUtil();
+
+        int[] a = {7, 9 , 30, 3};
+        System.out.println(JSON.toJSONString(a));
+        util.reverseArray(a);
+        System.out.println(JSON.toJSONString(a));
+    }
+
+    /**
+     * 现在有如下的一个数组：   int oldArr[]={1,3,4,5,0,0,6,6,0,5,4,7,6,7,0,5}
+     * 要求将以上数组中值为0的项去掉，将不为0的值存入一个新的数组，生成的新数组为：
+     * {1,3,4,5,6,6,5,4,7,6,7,5}
+     *
+     * @param oldArray
+     * @return
+     */
+
+    public int[] removeZero(int[] oldArray) {
+        return null;
+    }
+
+    /**
+     * 给定两个已经排序好的整形数组， a1和a2 ,  创建一个新的数组a3, 使得a3 包含a1和a2 的所有元素， 并且仍然是有序的
+     * 例如 a1 = [3, 5, 7,8]   a2 = [4, 5, 6,7]    则 a3 为[3,4,5,6,7,8]    , 注意： 已经消除了重复
+     *
+     * @param array1
+     * @param array2
+     * @return
+     */
+
+    public int[] merge(int[] array1, int[] array2) {
+        return null;
+    }
+
+    /**
+     * 把一个已经存满数据的数组 oldArray的容量进行扩展， 扩展后的新数据大小为oldArray.length + size
+     * 注意，老数组的元素在新数组中需要保持
+     * 例如 oldArray = [2,3,6] , size = 3,则返回的新数组为
+     * [2,3,6,0,0,0]
+     *
+     * @param oldArray
+     * @param size
+     * @return
+     */
+    public int[] grow(int[] oldArray, int size) {
+        return null;
+    }
+
+    /**
+     * 斐波那契数列为：1，1，2，3，5，8，13，21......  ，给定一个最大值， 返回小于该值的数列
+     * 例如， max = 15 , 则返回的数组应该为 [1，1，2，3，5，8，13]
+     * max = 1, 则返回空数组 []
+     *
+     * @param max
+     * @return
+     */
+    public int[] fibonacci(int max) {
+        return null;
+    }
+
+    /**
+     * 返回小于给定最大值max的所有素数数组
+     * 例如max = 23, 返回的数组为[2,3,5,7,11,13,17,19]
+     *
+     * @param max
+     * @return
+     */
+    public int[] getPrimes(int max) {
+        return null;
+    }
+
+    /**
+     * 所谓“完数”， 是指这个数恰好等于它的因子之和，例如6=1+2+3
+     * 给定一个最大值max， 返回一个数组， 数组中是小于max 的所有完数
+     *
+     * @param max
+     * @return
+     */
+    public int[] getPerfectNumbers(int max) {
+        return null;
+    }
+
+    /**
+     * 用seperator 把数组 array给连接起来
+     * 例如array= [3,8,9], seperator = "-"
+     * 则返回值为"3-8-9"
+     *
+     * @param array
+     * @param seperator
+     * @return
+     */
+    public String join(int[] array, String seperator) {
+        return null;
+    }
+
+
+}
diff --git a/group16/214074094/src/com/coderising/litestruts/LoginAction.java b/group16/214074094/src/main/java/study/coderising/litestruts/LoginAction.java
similarity index 92%
rename from group16/214074094/src/com/coderising/litestruts/LoginAction.java
rename to group16/214074094/src/main/java/study/coderising/litestruts/LoginAction.java
index 66b34536c7..511888c9b3 100644
--- a/group16/214074094/src/com/coderising/litestruts/LoginAction.java
+++ b/group16/214074094/src/main/java/study/coderising/litestruts/LoginAction.java
@@ -1,4 +1,4 @@
-package coderising.litestruts;
+package study.coderising.litestruts;
 
 /**
  * 这是一个用来展示登录的业务类， 其中的用户名和密码都是硬编码的。
diff --git a/group16/214074094/src/com/coderising/litestruts/Struts.java b/group16/214074094/src/main/java/study/coderising/litestruts/Struts.java
similarity index 93%
rename from group16/214074094/src/com/coderising/litestruts/Struts.java
rename to group16/214074094/src/main/java/study/coderising/litestruts/Struts.java
index 5a58101617..90de3c1a43 100644
--- a/group16/214074094/src/com/coderising/litestruts/Struts.java
+++ b/group16/214074094/src/main/java/study/coderising/litestruts/Struts.java
@@ -1,4 +1,4 @@
-package coderising.litestruts;
+package study.coderising.litestruts;
 
 import java.util.Map;
 
diff --git a/group16/214074094/src/com/coderising/litestruts/StrutsTest.java b/group16/214074094/src/main/java/study/coderising/litestruts/StrutsTest.java
similarity index 93%
rename from group16/214074094/src/com/coderising/litestruts/StrutsTest.java
rename to group16/214074094/src/main/java/study/coderising/litestruts/StrutsTest.java
index 057dd200b9..90dbf21689 100644
--- a/group16/214074094/src/com/coderising/litestruts/StrutsTest.java
+++ b/group16/214074094/src/main/java/study/coderising/litestruts/StrutsTest.java
@@ -1,4 +1,4 @@
-package coderising.litestruts;
+package study.coderising.litestruts;
 
 import java.util.HashMap;
 import java.util.Map;
diff --git a/group16/214074094/src/com/coderising/litestruts/View.java b/group16/214074094/src/main/java/study/coderising/litestruts/View.java
similarity index 85%
rename from group16/214074094/src/com/coderising/litestruts/View.java
rename to group16/214074094/src/main/java/study/coderising/litestruts/View.java
index 9b984eaedb..90b66b19dd 100644
--- a/group16/214074094/src/com/coderising/litestruts/View.java
+++ b/group16/214074094/src/main/java/study/coderising/litestruts/View.java
@@ -1,4 +1,4 @@
-package coderising.litestruts;
+package study.coderising.litestruts;
 
 import java.util.Map;
 
diff --git a/group16/214074094/src/com/coderising/litestruts/struts.xml b/group16/214074094/src/main/java/study/coderising/litestruts/struts.xml
similarity index 100%
rename from group16/214074094/src/com/coderising/litestruts/struts.xml
rename to group16/214074094/src/main/java/study/coderising/litestruts/struts.xml
diff --git a/group16/214074094/src/com/coding/basic/ArrayList.java b/group16/214074094/src/main/java/study/coding/basic/ArrayList.java
similarity index 99%
rename from group16/214074094/src/com/coding/basic/ArrayList.java
rename to group16/214074094/src/main/java/study/coding/basic/ArrayList.java
index 158c866d45..3f976e25ef 100644
--- a/group16/214074094/src/com/coding/basic/ArrayList.java
+++ b/group16/214074094/src/main/java/study/coding/basic/ArrayList.java
@@ -1,4 +1,4 @@
-package coding.basic;
+package study.coding.basic;
 
 
 import java.util.Arrays;
diff --git a/group16/214074094/src/com/coding/basic/BinaryTreeNode.java b/group16/214074094/src/main/java/study/coding/basic/BinaryTreeNode.java
similarity index 98%
rename from group16/214074094/src/com/coding/basic/BinaryTreeNode.java
rename to group16/214074094/src/main/java/study/coding/basic/BinaryTreeNode.java
index 32417cb157..95da5f0617 100644
--- a/group16/214074094/src/com/coding/basic/BinaryTreeNode.java
+++ b/group16/214074094/src/main/java/study/coding/basic/BinaryTreeNode.java
@@ -1,4 +1,4 @@
-package coding.basic;
+package study.coding.basic;
 
 /**
  * @Author shane
diff --git a/group16/214074094/src/com/coding/basic/Iterator.java b/group16/214074094/src/main/java/study/coding/basic/Iterator.java
similarity index 73%
rename from group16/214074094/src/com/coding/basic/Iterator.java
rename to group16/214074094/src/main/java/study/coding/basic/Iterator.java
index 1acc5349a4..0befe6a209 100644
--- a/group16/214074094/src/com/coding/basic/Iterator.java
+++ b/group16/214074094/src/main/java/study/coding/basic/Iterator.java
@@ -1,4 +1,4 @@
-package coding.basic;
+package study.coding.basic;
 
 public interface Iterator {
 
diff --git a/group16/214074094/src/com/coding/basic/LinkedList.java b/group16/214074094/src/main/java/study/coding/basic/LinkedList.java
similarity index 99%
rename from group16/214074094/src/com/coding/basic/LinkedList.java
rename to group16/214074094/src/main/java/study/coding/basic/LinkedList.java
index 9108c2b6fe..1b7d5bb7b8 100644
--- a/group16/214074094/src/com/coding/basic/LinkedList.java
+++ b/group16/214074094/src/main/java/study/coding/basic/LinkedList.java
@@ -1,4 +1,4 @@
-package coding.basic;
+package study.coding.basic;
 
 /**
  * @Author shane
diff --git a/group16/214074094/src/com/coding/basic/List.java b/group16/214074094/src/main/java/study/coding/basic/List.java
similarity index 85%
rename from group16/214074094/src/com/coding/basic/List.java
rename to group16/214074094/src/main/java/study/coding/basic/List.java
index 5da9b0d4c6..2c09924c45 100644
--- a/group16/214074094/src/com/coding/basic/List.java
+++ b/group16/214074094/src/main/java/study/coding/basic/List.java
@@ -1,4 +1,4 @@
-package coding.basic;
+package study.coding.basic;
 
 public interface List {
 
diff --git a/group16/214074094/src/com/coding/basic/Queue.java b/group16/214074094/src/main/java/study/coding/basic/Queue.java
similarity index 95%
rename from group16/214074094/src/com/coding/basic/Queue.java
rename to group16/214074094/src/main/java/study/coding/basic/Queue.java
index 869d0f7333..b15950ac36 100644
--- a/group16/214074094/src/com/coding/basic/Queue.java
+++ b/group16/214074094/src/main/java/study/coding/basic/Queue.java
@@ -1,4 +1,4 @@
-package coding.basic;
+package study.coding.basic;
 
 /**
  * @Author shane
diff --git a/group16/214074094/src/com/coding/basic/Stack.java b/group16/214074094/src/main/java/study/coding/basic/Stack.java
similarity index 95%
rename from group16/214074094/src/com/coding/basic/Stack.java
rename to group16/214074094/src/main/java/study/coding/basic/Stack.java
index 7ef1c9ad06..188de74ee9 100644
--- a/group16/214074094/src/com/coding/basic/Stack.java
+++ b/group16/214074094/src/main/java/study/coding/basic/Stack.java
@@ -1,4 +1,4 @@
-package coding.basic;
+package study.coding.basic;
 
 /**
  * @Author shane
diff --git a/group16/214074094/src/com/reading/blog.txt b/group16/214074094/src/main/java/study/reading/blog.txt
similarity index 100%
rename from group16/214074094/src/com/reading/blog.txt
rename to group16/214074094/src/main/java/study/reading/blog.txt
diff --git a/group16/214074094/src/test/coding/basic/AbstractTest.java b/group16/214074094/src/test/java/study/AbstractTest.java
similarity index 95%
rename from group16/214074094/src/test/coding/basic/AbstractTest.java
rename to group16/214074094/src/test/java/study/AbstractTest.java
index c0a7089660..42737e270f 100644
--- a/group16/214074094/src/test/coding/basic/AbstractTest.java
+++ b/group16/214074094/src/test/java/study/AbstractTest.java
@@ -1,4 +1,4 @@
-package coding.basic;
+package study;
 
 import com.alibaba.fastjson.JSON;
 
diff --git a/group16/214074094/src/test/coding/basic/ArrayListTest.java b/group16/214074094/src/test/java/study/coding/basic/ArrayListTest.java
similarity index 96%
rename from group16/214074094/src/test/coding/basic/ArrayListTest.java
rename to group16/214074094/src/test/java/study/coding/basic/ArrayListTest.java
index 2f03342d61..6ffe2e5715 100644
--- a/group16/214074094/src/test/coding/basic/ArrayListTest.java
+++ b/group16/214074094/src/test/java/study/coding/basic/ArrayListTest.java
@@ -1,9 +1,10 @@
-package coding.basic;
+package study.coding.basic;
 
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
+import study.AbstractTest;
 
 /**
  * @Author shane
diff --git a/group16/214074094/src/test/coding/basic/BinaryTreeNodeTest.java b/group16/214074094/src/test/java/study/coding/basic/BinaryTreeNodeTest.java
similarity index 92%
rename from group16/214074094/src/test/coding/basic/BinaryTreeNodeTest.java
rename to group16/214074094/src/test/java/study/coding/basic/BinaryTreeNodeTest.java
index bd0f152820..370b339434 100644
--- a/group16/214074094/src/test/coding/basic/BinaryTreeNodeTest.java
+++ b/group16/214074094/src/test/java/study/coding/basic/BinaryTreeNodeTest.java
@@ -1,6 +1,7 @@
-package coding.basic;
+package study.coding.basic;
 
 import org.junit.Test;
+import study.AbstractTest;
 
 /**
  * @Author shane
diff --git a/group16/214074094/src/test/coding/basic/LinkedListTest.java b/group16/214074094/src/test/java/study/coding/basic/LinkedListTest.java
similarity index 96%
rename from group16/214074094/src/test/coding/basic/LinkedListTest.java
rename to group16/214074094/src/test/java/study/coding/basic/LinkedListTest.java
index bc78728a25..f22d1cc611 100644
--- a/group16/214074094/src/test/coding/basic/LinkedListTest.java
+++ b/group16/214074094/src/test/java/study/coding/basic/LinkedListTest.java
@@ -1,9 +1,10 @@
-package coding.basic;
+package study.coding.basic;
 
 import junit.framework.Assert;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
+import study.AbstractTest;
 
 /**
  * @Author shane
diff --git a/group16/214074094/src/test/coding/basic/QueueTest.java b/group16/214074094/src/test/java/study/coding/basic/QueueTest.java
similarity index 95%
rename from group16/214074094/src/test/coding/basic/QueueTest.java
rename to group16/214074094/src/test/java/study/coding/basic/QueueTest.java
index 12302783b3..cdfe5c95ab 100644
--- a/group16/214074094/src/test/coding/basic/QueueTest.java
+++ b/group16/214074094/src/test/java/study/coding/basic/QueueTest.java
@@ -1,9 +1,10 @@
-package coding.basic;
+package study.coding.basic;
 
 import junit.framework.Assert;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
+import study.AbstractTest;
 
 /**
  * @Author shane
diff --git a/group16/214074094/src/test/coding/basic/StackTest.java b/group16/214074094/src/test/java/study/coding/basic/StackTest.java
similarity index 95%
rename from group16/214074094/src/test/coding/basic/StackTest.java
rename to group16/214074094/src/test/java/study/coding/basic/StackTest.java
index f289744a67..8269967dff 100644
--- a/group16/214074094/src/test/coding/basic/StackTest.java
+++ b/group16/214074094/src/test/java/study/coding/basic/StackTest.java
@@ -1,9 +1,10 @@
-package coding.basic;
+package study.coding.basic;
 
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
+import study.AbstractTest;
 
 /**
  * @Author shane

From 104c2de98c157cb258601b84ee25ae35de0d89d9 Mon Sep 17 00:00:00 2001
From: shane <baohua.shan@zhulebei.com>
Date: Wed, 1 Mar 2017 20:31:37 +0800
Subject: [PATCH 17/36] add ArrayUtilTest.java

---
 .../test/java/study/coderising/ArrayUtilTest.java   | 13 +++++++++++++
 1 file changed, 13 insertions(+)
 create mode 100644 group16/214074094/src/test/java/study/coderising/ArrayUtilTest.java

diff --git a/group16/214074094/src/test/java/study/coderising/ArrayUtilTest.java b/group16/214074094/src/test/java/study/coderising/ArrayUtilTest.java
new file mode 100644
index 0000000000..a0268b13f0
--- /dev/null
+++ b/group16/214074094/src/test/java/study/coderising/ArrayUtilTest.java
@@ -0,0 +1,13 @@
+package study.coderising;
+
+import study.AbstractTest;
+
+/**
+ * @Author shane
+ * @Time 2017/3/1 20:29
+ * @Email shanbaohua@lxfintech.com
+ * @Desc ...
+ */
+public class ArrayUtilTest extends AbstractTest {
+
+}

From 623aab95859b4e9b05d887786bcfe4b3af61eeda Mon Sep 17 00:00:00 2001
From: shane <baohua.shan@zhulebei.com>
Date: Wed, 1 Mar 2017 21:49:58 +0800
Subject: [PATCH 18/36] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../java/study/coding/basic/ArrayList.java    |  4 +--
 .../study/coding/basic/BinaryTreeNode.java    | 32 +++++++++----------
 .../java/study/coding/basic/LinkedList.java   |  1 +
 3 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/group16/214074094/src/main/java/study/coding/basic/ArrayList.java b/group16/214074094/src/main/java/study/coding/basic/ArrayList.java
index 3f976e25ef..8b50b8ed2e 100644
--- a/group16/214074094/src/main/java/study/coding/basic/ArrayList.java
+++ b/group16/214074094/src/main/java/study/coding/basic/ArrayList.java
@@ -73,7 +73,7 @@ public void add(int index, Object o) {
 
     @Override
     public Object get(int index) {
-        if (index < 0 || index > size) {
+        if (index < 0 || index >= size) {
             throw new IndexOutOfBoundsException("Index:" + index + ", Size:" + size);
         }
         return elementData[index];
@@ -82,7 +82,7 @@ public Object get(int index) {
     @Override
     public Object remove(int index) {
 
-        if (index < 0 || index > size) {
+        if (index < 0 || index >= size) {
             throw new IndexOutOfBoundsException("Index:" + index + ", Size:" + size);
         }
         Object oldValue = elementData[index];
diff --git a/group16/214074094/src/main/java/study/coding/basic/BinaryTreeNode.java b/group16/214074094/src/main/java/study/coding/basic/BinaryTreeNode.java
index 95da5f0617..4eae81c97a 100644
--- a/group16/214074094/src/main/java/study/coding/basic/BinaryTreeNode.java
+++ b/group16/214074094/src/main/java/study/coding/basic/BinaryTreeNode.java
@@ -17,24 +17,24 @@ public class BinaryTreeNode {
     public BinaryTreeNode insert(Object o) {
         if (null == data) {
             data = o;
-        } else {
-            if (bigger(data, o)) {
-                if (null == left) {
-                    left = new BinaryTreeNode();
-                    left.data = o;
-                } else {
-                    left.insert(o);
-                }
-            } else if (smaller(data, o)) {
-                if (null == right) {
-                    right = new BinaryTreeNode();
-                    right.data = o;
-                } else {
-                    right.insert(o);
-                }
+            return this;
+        }
+        if (bigger(data, o)) {
+            if (null == left) {
+                left = new BinaryTreeNode();
+                left.data = o;
             } else {
-                throw new RuntimeException("The value has exists");
+                left.insert(o);
             }
+        } else if (smaller(data, o)) {
+            if (null == right) {
+                right = new BinaryTreeNode();
+                right.data = o;
+            } else {
+                right.insert(o);
+            }
+        } else {
+            throw new RuntimeException("The value has exists");
         }
         return this;
     }
diff --git a/group16/214074094/src/main/java/study/coding/basic/LinkedList.java b/group16/214074094/src/main/java/study/coding/basic/LinkedList.java
index 1b7d5bb7b8..d9f0a753d2 100644
--- a/group16/214074094/src/main/java/study/coding/basic/LinkedList.java
+++ b/group16/214074094/src/main/java/study/coding/basic/LinkedList.java
@@ -50,6 +50,7 @@ public Object remove(int index) {
         } else if (index == size - 1) {
             return removeLast();
         }
+        
         Node curr = _node(index);
         Object data = curr.data;
         final Node prev = curr.prev;

From 43059714ada0de61721218a6ee9b4dccf0284465 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=AD=E5=B7=9E-=E5=A4=A7=E6=98=8E?= <420355244@qq.com>
Date: Wed, 1 Mar 2017 22:02:26 +0800
Subject: [PATCH 19/36] delete old

---
 group16/420355244/.classpath                  |   7 -
 group16/420355244/.gitignore                  |   1 -
 group16/420355244/.project                    |  17 --
 .../src/com/coding/basic/ArrayList.java       |  91 -------
 .../src/com/coding/basic/ArrayListTest.java   |  64 -----
 .../src/com/coding/basic/BinaryTreeNode.java  |  32 ---
 .../src/com/coding/basic/Iterator.java        |   7 -
 .../src/com/coding/basic/LinkedList.java      | 224 ------------------
 .../src/com/coding/basic/LinkedListTest.java  | 112 ---------
 .../420355244/src/com/coding/basic/List.java  |   9 -
 .../420355244/src/com/coding/basic/Queue.java |  66 ------
 .../src/com/coding/basic/QueueTest.java       |  56 -----
 .../420355244/src/com/coding/basic/Stack.java |  39 ---
 .../src/com/coding/basic/StackTest.java       |  64 -----
 14 files changed, 789 deletions(-)
 delete mode 100644 group16/420355244/.classpath
 delete mode 100644 group16/420355244/.gitignore
 delete mode 100644 group16/420355244/.project
 delete mode 100644 group16/420355244/src/com/coding/basic/ArrayList.java
 delete mode 100644 group16/420355244/src/com/coding/basic/ArrayListTest.java
 delete mode 100644 group16/420355244/src/com/coding/basic/BinaryTreeNode.java
 delete mode 100644 group16/420355244/src/com/coding/basic/Iterator.java
 delete mode 100644 group16/420355244/src/com/coding/basic/LinkedList.java
 delete mode 100644 group16/420355244/src/com/coding/basic/LinkedListTest.java
 delete mode 100644 group16/420355244/src/com/coding/basic/List.java
 delete mode 100644 group16/420355244/src/com/coding/basic/Queue.java
 delete mode 100644 group16/420355244/src/com/coding/basic/QueueTest.java
 delete mode 100644 group16/420355244/src/com/coding/basic/Stack.java
 delete mode 100644 group16/420355244/src/com/coding/basic/StackTest.java

diff --git a/group16/420355244/.classpath b/group16/420355244/.classpath
deleted file mode 100644
index 3e0fb272a8..0000000000
--- a/group16/420355244/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-	<classpathentry kind="src" path="src"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
-	<classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/group16/420355244/.gitignore b/group16/420355244/.gitignore
deleted file mode 100644
index ae3c172604..0000000000
--- a/group16/420355244/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/bin/
diff --git a/group16/420355244/.project b/group16/420355244/.project
deleted file mode 100644
index aec36208a6..0000000000
--- a/group16/420355244/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-	<name>Homework</name>
-	<comment></comment>
-	<projects>
-	</projects>
-	<buildSpec>
-		<buildCommand>
-			<name>org.eclipse.jdt.core.javabuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-	</buildSpec>
-	<natures>
-		<nature>org.eclipse.jdt.core.javanature</nature>
-	</natures>
-</projectDescription>
diff --git a/group16/420355244/src/com/coding/basic/ArrayList.java b/group16/420355244/src/com/coding/basic/ArrayList.java
deleted file mode 100644
index 6534c3c029..0000000000
--- a/group16/420355244/src/com/coding/basic/ArrayList.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package com.coding.basic;
-
-import java.util.Arrays;
-
-public class ArrayList implements List {
-	
-	private int size = 0;
-	
-	private Object[] elementData = new Object[100];
-	
-	public void add(Object o){
-		if(size < elementData.length){
-			elementData[size] = o;
-		}else{
-			Object[] newElementData = new Object[elementData.length + elementData.length/2];
-			System.arraycopy(elementData, 0, newElementData, 0, size);
-			newElementData[size] = o;
-			this.elementData = newElementData;
-		}
-		size++;
-		
-	}
-	public void add(int index, Object o){
-		if(index >= 0 && index <= size){
-			//1.不扩容
-			if(index == size - 1){
-				//1.1 加在最后
-				elementData[index] = o;
-			}else{
-				//1.2 加在前面
-				//index的位置的数值变为改对象，index以后位置的都往后挪一位
-				Object[] newElementData = new Object[elementData.length];
-				System.arraycopy(elementData, 0, newElementData, 0, index);
-				newElementData[index] = o ;
-				System.arraycopy(elementData, index, newElementData, index + 1, size - index);
-				this.elementData = newElementData;
-			}
-			size++;
-		}else{
-			throw new IndexOutOfBoundsException();
-		}
-	}
-	
-	public Object get(int index){
-		if(index < size){
-			return elementData[index];
-		}else{
-			throw new IndexOutOfBoundsException();
-		}
-	}
-	
-	public Object remove(int index){
-		if(index < size){
-			Object obj = elementData[index];
-			Object[] newElementData = new Object[elementData.length];
-			if(size != 1){
-				//1.若集合长度为1
-				if(0 == index){
-					//1.1.如果remove的是0索引的
-					System.arraycopy(elementData, 1, newElementData, 0, size - 1);
-				}else if(index == size -1){
-					//1.2.如果remove的是最后索引的
-					System.arraycopy(elementData, 0, newElementData, 0, size - 1);
-				}else{
-					//1.3.在中间
-					System.arraycopy(elementData, 0, newElementData, 0, index);
-					System.arraycopy(elementData, index + 1, newElementData, index, size - index - 1);
-				}
-			}
-			this.elementData = newElementData;
-			size--;
-			return obj;
-		}else{
-			throw new IndexOutOfBoundsException();
-		}
-	}
-	
-	public int size(){
-		return size;
-	}
-	
-	public Iterator iterator(){
-		return null;
-	}
-	@Override
-	public String toString() {
-		return "ArrayList [size=" + size + ", elementData=" + Arrays.toString(elementData) + "]";
-	}
-	
-	
-}
diff --git a/group16/420355244/src/com/coding/basic/ArrayListTest.java b/group16/420355244/src/com/coding/basic/ArrayListTest.java
deleted file mode 100644
index 2f48bdf4c8..0000000000
--- a/group16/420355244/src/com/coding/basic/ArrayListTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package com.coding.basic;
-
-import static org.junit.Assert.fail;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class ArrayListTest {
-
-	private static ArrayList arrayList = new ArrayList();
-	
-	@Before
-	public void setUp() throws Exception {
-	}
-
-	@Test
-	public void testAddObject() {
-		for(int i = 0 ;i < 150; i++){
-			arrayList.add("aaa");
-		}
-		System.out.println(arrayList);
-		System.out.println(arrayList.size());
-	}
-
-	@Test
-	public void testAddIntObject() {
-		arrayList.add("aaa");
-		arrayList.add("bbb");
-		arrayList.add("ccc");
-		arrayList.add("ddd");
-		arrayList.add(1,"eee");
-		System.out.println(arrayList);
-	}
-
-	@Test
-	public void testGet() {
-		arrayList.add("aaa");
-		arrayList.add("bbb");
-		arrayList.add("ccc");
-		arrayList.add("ddd");
-		Object object = arrayList.get(0);
-		System.out.println(object);
-	}
-
-	@Test
-	public void testRemove() {
-		arrayList.add("aaa");
-		arrayList.add("bbb");
-		arrayList.add("ccc");
-		arrayList.add("ddd");
-		arrayList.remove(0);
-		System.out.println(arrayList);
-	}
-
-	@Test
-	public void testSize() {
-		arrayList.add("aaa");
-		arrayList.add("bbb");
-		arrayList.add("ccc");
-		arrayList.add("ddd");
-		System.out.println(arrayList.size());
-	}
-
-}
diff --git a/group16/420355244/src/com/coding/basic/BinaryTreeNode.java b/group16/420355244/src/com/coding/basic/BinaryTreeNode.java
deleted file mode 100644
index d7ac820192..0000000000
--- a/group16/420355244/src/com/coding/basic/BinaryTreeNode.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.coding.basic;
-
-public class BinaryTreeNode {
-	
-	private Object data;
-	private BinaryTreeNode left;
-	private BinaryTreeNode right;
-	
-	public Object getData() {
-		return data;
-	}
-	public void setData(Object data) {
-		this.data = data;
-	}
-	public BinaryTreeNode getLeft() {
-		return left;
-	}
-	public void setLeft(BinaryTreeNode left) {
-		this.left = left;
-	}
-	public BinaryTreeNode getRight() {
-		return right;
-	}
-	public void setRight(BinaryTreeNode right) {
-		this.right = right;
-	}
-	
-	public BinaryTreeNode insert(Object o){
-		return  null;
-	}
-	
-}
diff --git a/group16/420355244/src/com/coding/basic/Iterator.java b/group16/420355244/src/com/coding/basic/Iterator.java
deleted file mode 100644
index 06ef6311b2..0000000000
--- a/group16/420355244/src/com/coding/basic/Iterator.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.coding.basic;
-
-public interface Iterator {
-	public boolean hasNext();
-	public Object next();
-
-}
diff --git a/group16/420355244/src/com/coding/basic/LinkedList.java b/group16/420355244/src/com/coding/basic/LinkedList.java
deleted file mode 100644
index 9af35a399d..0000000000
--- a/group16/420355244/src/com/coding/basic/LinkedList.java
+++ /dev/null
@@ -1,224 +0,0 @@
-package com.coding.basic;
-
-import java.util.NoSuchElementException;
-
-public class LinkedList implements List {
-	
-	
-	private Node first;
-	
-	private Node last;
-	
-	private int size = 0;
-	
-	public void add(Object o){
-		if(null == first){
-			//当链表元素为空时，新建一个Node
-			Node node = new Node();
-			node.data = o;
-			node.next = null;
-			first = node;
-			last = node;
-			size ++;
-		}else{
-			addLast(o);
-		}
-	}
-	public void add(int index , Object o){
-		if(index < 0 || index >= size){
-			//数组越界异常
-			throw new IndexOutOfBoundsException();
-		}else{
-			if(0 == index){
-				//1.如果加在头上
-				addFirst(o);
-			}else{
-				//2.加在中间位置
-				Node node = first.next;
-				int nodeIndex = 1;
-				if(nodeIndex == index){
-					//如果是第二个位置的话
-					Node nodeAdd = new Node();
-					nodeAdd.data = o;
-					first.next = nodeAdd;
-					nodeAdd.next = node;
-					last = node;
-					size ++;
-				}
-				//第三个位置及以后、开始遍历所有的索引
-				while(null != node.next){
-					//保留遍历中node之前的结点
-					Node nodeLast = node;
-					node = node.next;
-					nodeIndex++;
-					if(nodeIndex == index){
-						Node nodeAdd = new Node();
-						nodeAdd.data = o;
-						nodeLast.next = nodeAdd;
-						nodeAdd.next = node;
-						size ++;
-						break;
-					}
-				}
-			}
-		}
-		
-	}
-	public Object get(int index){
-		if(index < 0 || index >= size){
-			//数组越界异常
-			throw new IndexOutOfBoundsException();
-		}else{
-			if(0 == index){
-				//1.如果加在头上
-				return first.data;
-			}
-			Node node = first.next;
-			int nodeIndex = 1;
-			if(nodeIndex == index){
-				//如果是第二个位置的话
-				return node.data;
-			}
-			//第三个位置及以后、开始遍历所有的索引
-			while(null != node.next){
-				//保留遍历中node之前的结点
-				node = node.next;
-				nodeIndex++;
-				if(nodeIndex == index){
-					return node.data;
-				}
-			}
-		}
-		throw new IndexOutOfBoundsException();
-	}
-	public Object remove(int index){
-		if(index < 0 || index >= size){
-			//数组越界异常
-			throw new IndexOutOfBoundsException();
-		}else{
-			if(0 == index){
-				//1.如果移除头
-				removeFirst();
-			}else if(index == (size - 1)){
-				//2.移除尾
-				removeLast();
-			}else{
-				//3.移除中间位置
-				Node node = first.next;
-				//从first的零号索引开始
-				int nodeIndex = 1;
-				
-				//开始遍历所有的索引，记住要移除的索引位数据的前后结点
-				Node lastNode = first;
-				if(index == nodeIndex){
-					//第一次不匹配则后续的循环执行
-					Object o = node.data;
-					lastNode.next = node.next;
-					size--;
-					return o;
-				}else{
-					while(null != node.next){
-						lastNode = node;
-						node = node.next;
-						nodeIndex++;
-						if(index == nodeIndex){
-							Object o = node.data;
-							lastNode.next = node.next;
-							size--;
-							return o;
-						}
-					}
-				}
-			}
-		}
-		throw new IndexOutOfBoundsException();
-	}
-	
-	public int size(){
-		return size;
-	}
-	
-	public void addFirst(Object o){
-		Node node = new Node();
-		node.data = o ;
-		node.next = first;
-		first = node;
-		size++;
-	}
-	public void addLast(Object o){
-		Node node = new Node();
-		node.data = o ;
-		node.next = null;
-		last.next = node;
-		last = node;
-		size++;
-	}
-	public Object removeFirst(){
-		Object o = first.data;
-		Node node = first.next;
-		first = node;
-		size--;
-		return o;
-	}
-	public Object removeLast(){
-		if(0 == size){
-			throw new NoSuchElementException();
-			
-		}else if(1 == size){
-			//只有一个元素
-			removeFirst();
-		}else{
-			//第二个元素
-			Node node = first.next;
-			if(null == node.next){
-				Object o = node.data;
-				last = first;
-				first.next = null;
-				return o;
-			}else{
-				while(null != node.next){
-					//若不止只有2个 ，记录最后一个结点的前一个。
-					Node lastNode = node;
-					node = node.next;
-					if(null == node.next){
-						Object o = node.data;
-						lastNode.next = null;
-						last = lastNode;
-						size--;
-						return o;
-					}
-				}
-			}
-		}
-		throw new NoSuchElementException();
-	}
-	public Iterator iterator(){
-		return null;
-	}
-	
-	
-	private static  class Node{
-		Object data;
-		Node next;
-		
-	}
-
-
-	@Override
-	public String toString() {
-		StringBuilder sb = new StringBuilder();
-		if(null != first){
-			sb.append(first.data.toString() + ",");
-			Node node = first.next;
-			sb.append(node.data.toString() + ",");
-			while(null != node.next){
-				node = node.next;
-				sb.append(node.data.toString() + ",");
-			}
-		}
-		return sb.toString();
-	}
-
-
-	
-}
diff --git a/group16/420355244/src/com/coding/basic/LinkedListTest.java b/group16/420355244/src/com/coding/basic/LinkedListTest.java
deleted file mode 100644
index 2caea9679b..0000000000
--- a/group16/420355244/src/com/coding/basic/LinkedListTest.java
+++ /dev/null
@@ -1,112 +0,0 @@
-package com.coding.basic;
-
-import static org.junit.Assert.*;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class LinkedListTest {
-	private static LinkedList linkedList = new LinkedList();
-	@Before
-	public void setUp() throws Exception {
-	}
-
-	@Test
-	public void testAddObject() {
-		linkedList.add("aaa");
-		linkedList.add("bbb");
-		System.out.println(linkedList);
-	}
-
-	@Test
-	public void testAddIntObject() {
-		linkedList.add("aaa");
-		linkedList.add("bbb");
-		linkedList.add("ccc");
-		linkedList.add(2,"ddd");
-		System.out.println(linkedList);
-		System.out.println(linkedList.size());
-	}
-
-	@Test
-	public void testGet() {
-		linkedList.add("aaa");
-		linkedList.add("bbb");
-		linkedList.add("ccc");
-		linkedList.add("eee");
-		linkedList.add("fff");
-		linkedList.add("ddd");
-//		System.out.println(linkedList.size());
-		System.out.println(linkedList.get(3));
-	}
-
-	@Test
-	public void testRemove() {
-		linkedList.add("aaa");
-		linkedList.add("bbb");
-		linkedList.add("ccc");
-		linkedList.add("eee");
-		linkedList.add("fff");
-		linkedList.add("ddd");
-		linkedList.remove(5);
-		linkedList.remove(1);
-		linkedList.remove(2);
-		System.out.println(linkedList);
-		System.out.println(linkedList.size());
-	}
-
-	@Test
-	public void testSize() {
-		linkedList.add("aaa");
-		linkedList.add("bbb");
-		linkedList.add("ccc");
-		linkedList.add("eee");
-		linkedList.add("fff");
-		linkedList.add("ddd");
-		System.out.println(linkedList.size());
-	}
-
-	@Test
-	public void testAddFirst() {
-		linkedList.add("aaa");
-		linkedList.add("bbb");
-		linkedList.addFirst("sss");
-		System.out.println(linkedList);
-	}
-
-	@Test
-	public void testAddLast() {
-		linkedList.add("aaa");
-		linkedList.add("bbb");
-		linkedList.add("ccc");
-		System.out.println(linkedList);
-	}
-
-	@Test
-	public void testRemoveFirst() {
-		linkedList.add("aaa");
-		linkedList.add("bbb");
-		linkedList.add("ccc");
-		linkedList.removeFirst();
-		linkedList.addFirst("eee");
-		linkedList.removeFirst();
-		System.out.println(linkedList);
-	}
-
-	@Test
-	public void testRemoveLast() {
-		linkedList.add("aaa");
-		linkedList.add("bbb");
-		linkedList.add("ccc");
-		linkedList.removeLast();
-		linkedList.add("eee");
-		linkedList.addFirst("xxx");
-		System.out.println(linkedList);
-	}
-
-	@Test
-	public void testIterator() {
-		fail("Not yet implemented");
-	}
-
-}
diff --git a/group16/420355244/src/com/coding/basic/List.java b/group16/420355244/src/com/coding/basic/List.java
deleted file mode 100644
index 10d13b5832..0000000000
--- a/group16/420355244/src/com/coding/basic/List.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.coding.basic;
-
-public interface List {
-	public void add(Object o);
-	public void add(int index, Object o);
-	public Object get(int index);
-	public Object remove(int index);
-	public int size();
-}
diff --git a/group16/420355244/src/com/coding/basic/Queue.java b/group16/420355244/src/com/coding/basic/Queue.java
deleted file mode 100644
index a2f9577b7b..0000000000
--- a/group16/420355244/src/com/coding/basic/Queue.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package com.coding.basic;
-
-public class Queue {
-	private Node first;
-	private Node last;
-	private int size = 0;
-	public void enQueue(Object o){	
-		if(null == first){
-			Node node = new Node();
-			node.data = o;
-			node.next = null;
-			first = node;
-			last = node;
-		}else{
-			Node node = new Node();
-			node.data = o;
-			node.next = null;
-			last.next = node;
-			last = node;
-		}
-		size++;
-	}
-	
-	public Object deQueue(){
-		Node second = first.next;
-		Object o = first.data;
-		if(null != second){
-			first = second;
-			return o;
-		}else{
-			first = null;
-			size = 0;
-			return o;
-		}
-	}
-	
-	public boolean isEmpty(){
-		if(size > 0){
-			return false;
-		}else{
-			return true;
-		}
-	}
-	
-	public int size(){
-		return size;
-	}
-	static class Node{
-		Node next;
-		Object data;
-	}
-	@Override
-	public String toString() {
-		StringBuilder sb = new StringBuilder();
-		if(null != first){
-			sb.append(first.data.toString() + ",");
-			Node node = first.next;
-			sb.append(node.data.toString() + ",");
-			while(null != node.next){
-				node = node.next;
-				sb.append(node.data.toString() + ",");
-			}
-		}
-		return sb.toString();
-	}
-}
diff --git a/group16/420355244/src/com/coding/basic/QueueTest.java b/group16/420355244/src/com/coding/basic/QueueTest.java
deleted file mode 100644
index 50d7fc0903..0000000000
--- a/group16/420355244/src/com/coding/basic/QueueTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package com.coding.basic;
-
-import static org.junit.Assert.*;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class QueueTest {
-
-	public static Queue queue = new Queue();
-	@Before
-	public void setUp() throws Exception {
-	}
-
-	@Test
-	public void testEnQueue() {
-		queue.enQueue("aaa");
-		queue.enQueue("bbb");
-		queue.enQueue("ccc");
-		queue.enQueue("aaa");
-		System.out.println(queue);
-	}
-
-	@Test
-	public void testDeQueue() {
-		queue.enQueue("aaa");
-		queue.enQueue("bbb");
-		queue.enQueue("ccc");
-		queue.enQueue("ddd");
-		queue.enQueue("eee");
-		queue.deQueue();
-		System.out.println(queue);
-	}
-
-	@Test
-	public void testIsEmpty() {
-		System.out.println(queue.isEmpty());
-		
-	}
-
-	@Test
-	public void testSize() {
-		queue.enQueue("aaa");
-		queue.enQueue("bbb");
-		queue.enQueue("ccc");
-		queue.enQueue("ddd");
-		queue.enQueue("eee");
-		System.out.println(queue.size());
-	}
-
-	@Test
-	public void testToString() {
-		fail("Not yet implemented");
-	}
-
-}
diff --git a/group16/420355244/src/com/coding/basic/Stack.java b/group16/420355244/src/com/coding/basic/Stack.java
deleted file mode 100644
index 5c59bf34fc..0000000000
--- a/group16/420355244/src/com/coding/basic/Stack.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.coding.basic;
-
-public class Stack {
-	private ArrayList elementData = new ArrayList();
-	private int size = 0;
-	public void push(Object o){	
-		//入栈在栈顶进入最后压入
-		elementData.add(o);
-		size ++;
-	}
-	
-	public Object pop(){
-		Object object = elementData.get(size -1);
-		elementData.remove(size -1);
-		size --;
-		return object;
-	}
-	
-	public Object peek(){
-		Object object = elementData.get(size -1);
-		return object;
-	}
-	public boolean isEmpty(){
-		if(size <= 0){
-			return true;
-		}else{
-			return false;
-		}
-	}
-	public int size(){
-		return size;
-	}
-
-	@Override
-	public String toString() {
-		return elementData.toString();
-	}
-	
-}
diff --git a/group16/420355244/src/com/coding/basic/StackTest.java b/group16/420355244/src/com/coding/basic/StackTest.java
deleted file mode 100644
index 0628e7c76e..0000000000
--- a/group16/420355244/src/com/coding/basic/StackTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package com.coding.basic;
-
-import static org.junit.Assert.*;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class StackTest {
-	private static Stack stack = new Stack();
-	@Before
-	public void setUp() throws Exception {
-	}
-
-	@Test
-	public void testPush() {
-		stack.push("aaa");
-		stack.push("bbb");
-		stack.push("ccc");
-		System.out.println(stack);
-	}
-
-	@Test
-	public void testPop() {
-		stack.push("aaa");
-		stack.push("bbb");
-		stack.push("ccc");
-		Object pop = stack.pop();
-		System.out.println(pop);
-		System.out.println(stack);
-	}
-
-	@Test
-	public void testPeek() {
-		stack.push("aaa");
-		stack.push("bbb");
-		stack.push("ccc");
-		Object peek = stack.peek();
-		System.out.println(peek);
-	}
-
-	@Test
-	public void testIsEmpty() {
-		System.out.println(stack.isEmpty());
-		stack.push("aaa");
-		stack.push("bbb");
-		stack.push("ccc");
-		System.out.println(stack.isEmpty());
-		stack.pop();
-		stack.pop();
-		stack.pop();
-		System.out.println(stack.isEmpty());
-	}
-
-	@Test
-	public void testSize() {
-		stack.push("aaa");
-		stack.push("bbb");
-		stack.push("ccc");
-		stack.pop();
-		stack.pop();
-		System.out.println(stack.size());
-	}
-
-}

From c9f3a3bff10d13fe6921fb60a5e71c6dacb61afd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=AD=E5=B7=9E-=E5=A4=A7=E6=98=8E?= <420355244@qq.com>
Date: Wed, 1 Mar 2017 22:08:31 +0800
Subject: [PATCH 20/36] change project

---
 group16/420355244/Homework1/.classpath        |   7 +
 group16/420355244/Homework1/.gitignore        |   1 +
 group16/420355244/Homework1/.project          |  17 ++
 .../.settings/org.eclipse.jdt.core.prefs      |  11 +
 .../src/com/coding/basic/ArrayList.java       |  91 +++++++
 .../src/com/coding/basic/ArrayListTest.java   |  62 +++++
 .../src/com/coding/basic/BinaryTreeNode.java  |  32 +++
 .../src/com/coding/basic/Iterator.java        |   7 +
 .../src/com/coding/basic/LinkedList.java      | 224 ++++++++++++++++++
 .../src/com/coding/basic/LinkedListTest.java  | 112 +++++++++
 .../Homework1/src/com/coding/basic/List.java  |   9 +
 .../Homework1/src/com/coding/basic/Queue.java |  66 ++++++
 .../src/com/coding/basic/QueueTest.java       |  56 +++++
 .../Homework1/src/com/coding/basic/Stack.java |  39 +++
 .../src/com/coding/basic/StackTest.java       |  62 +++++
 15 files changed, 796 insertions(+)
 create mode 100644 group16/420355244/Homework1/.classpath
 create mode 100644 group16/420355244/Homework1/.gitignore
 create mode 100644 group16/420355244/Homework1/.project
 create mode 100644 group16/420355244/Homework1/.settings/org.eclipse.jdt.core.prefs
 create mode 100644 group16/420355244/Homework1/src/com/coding/basic/ArrayList.java
 create mode 100644 group16/420355244/Homework1/src/com/coding/basic/ArrayListTest.java
 create mode 100644 group16/420355244/Homework1/src/com/coding/basic/BinaryTreeNode.java
 create mode 100644 group16/420355244/Homework1/src/com/coding/basic/Iterator.java
 create mode 100644 group16/420355244/Homework1/src/com/coding/basic/LinkedList.java
 create mode 100644 group16/420355244/Homework1/src/com/coding/basic/LinkedListTest.java
 create mode 100644 group16/420355244/Homework1/src/com/coding/basic/List.java
 create mode 100644 group16/420355244/Homework1/src/com/coding/basic/Queue.java
 create mode 100644 group16/420355244/Homework1/src/com/coding/basic/QueueTest.java
 create mode 100644 group16/420355244/Homework1/src/com/coding/basic/Stack.java
 create mode 100644 group16/420355244/Homework1/src/com/coding/basic/StackTest.java

diff --git a/group16/420355244/Homework1/.classpath b/group16/420355244/Homework1/.classpath
new file mode 100644
index 0000000000..373dce4005
--- /dev/null
+++ b/group16/420355244/Homework1/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/group16/420355244/Homework1/.gitignore b/group16/420355244/Homework1/.gitignore
new file mode 100644
index 0000000000..ae3c172604
--- /dev/null
+++ b/group16/420355244/Homework1/.gitignore
@@ -0,0 +1 @@
+/bin/
diff --git a/group16/420355244/Homework1/.project b/group16/420355244/Homework1/.project
new file mode 100644
index 0000000000..ec1134f33a
--- /dev/null
+++ b/group16/420355244/Homework1/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>Homework1</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>
diff --git a/group16/420355244/Homework1/.settings/org.eclipse.jdt.core.prefs b/group16/420355244/Homework1/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..3a21537071
--- /dev/null
+++ b/group16/420355244/Homework1/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/group16/420355244/Homework1/src/com/coding/basic/ArrayList.java b/group16/420355244/Homework1/src/com/coding/basic/ArrayList.java
new file mode 100644
index 0000000000..6534c3c029
--- /dev/null
+++ b/group16/420355244/Homework1/src/com/coding/basic/ArrayList.java
@@ -0,0 +1,91 @@
+package com.coding.basic;
+
+import java.util.Arrays;
+
+public class ArrayList implements List {
+	
+	private int size = 0;
+	
+	private Object[] elementData = new Object[100];
+	
+	public void add(Object o){
+		if(size < elementData.length){
+			elementData[size] = o;
+		}else{
+			Object[] newElementData = new Object[elementData.length + elementData.length/2];
+			System.arraycopy(elementData, 0, newElementData, 0, size);
+			newElementData[size] = o;
+			this.elementData = newElementData;
+		}
+		size++;
+		
+	}
+	public void add(int index, Object o){
+		if(index >= 0 && index <= size){
+			//1.不扩容
+			if(index == size - 1){
+				//1.1 加在最后
+				elementData[index] = o;
+			}else{
+				//1.2 加在前面
+				//index的位置的数值变为改对象，index以后位置的都往后挪一位
+				Object[] newElementData = new Object[elementData.length];
+				System.arraycopy(elementData, 0, newElementData, 0, index);
+				newElementData[index] = o ;
+				System.arraycopy(elementData, index, newElementData, index + 1, size - index);
+				this.elementData = newElementData;
+			}
+			size++;
+		}else{
+			throw new IndexOutOfBoundsException();
+		}
+	}
+	
+	public Object get(int index){
+		if(index < size){
+			return elementData[index];
+		}else{
+			throw new IndexOutOfBoundsException();
+		}
+	}
+	
+	public Object remove(int index){
+		if(index < size){
+			Object obj = elementData[index];
+			Object[] newElementData = new Object[elementData.length];
+			if(size != 1){
+				//1.若集合长度为1
+				if(0 == index){
+					//1.1.如果remove的是0索引的
+					System.arraycopy(elementData, 1, newElementData, 0, size - 1);
+				}else if(index == size -1){
+					//1.2.如果remove的是最后索引的
+					System.arraycopy(elementData, 0, newElementData, 0, size - 1);
+				}else{
+					//1.3.在中间
+					System.arraycopy(elementData, 0, newElementData, 0, index);
+					System.arraycopy(elementData, index + 1, newElementData, index, size - index - 1);
+				}
+			}
+			this.elementData = newElementData;
+			size--;
+			return obj;
+		}else{
+			throw new IndexOutOfBoundsException();
+		}
+	}
+	
+	public int size(){
+		return size;
+	}
+	
+	public Iterator iterator(){
+		return null;
+	}
+	@Override
+	public String toString() {
+		return "ArrayList [size=" + size + ", elementData=" + Arrays.toString(elementData) + "]";
+	}
+	
+	
+}
diff --git a/group16/420355244/Homework1/src/com/coding/basic/ArrayListTest.java b/group16/420355244/Homework1/src/com/coding/basic/ArrayListTest.java
new file mode 100644
index 0000000000..420c412a7b
--- /dev/null
+++ b/group16/420355244/Homework1/src/com/coding/basic/ArrayListTest.java
@@ -0,0 +1,62 @@
+package com.coding.basic;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class ArrayListTest {
+
+	private static ArrayList arrayList = new ArrayList();
+	
+	@Before
+	public void setUp() throws Exception {
+	}
+
+	@Test
+	public void testAddObject() {
+		for(int i = 0 ;i < 150; i++){
+			arrayList.add("aaa");
+		}
+		System.out.println(arrayList);
+		System.out.println(arrayList.size());
+	}
+
+	@Test
+	public void testAddIntObject() {
+		arrayList.add("aaa");
+		arrayList.add("bbb");
+		arrayList.add("ccc");
+		arrayList.add("ddd");
+		arrayList.add(1,"eee");
+		System.out.println(arrayList);
+	}
+
+	@Test
+	public void testGet() {
+		arrayList.add("aaa");
+		arrayList.add("bbb");
+		arrayList.add("ccc");
+		arrayList.add("ddd");
+		Object object = arrayList.get(0);
+		System.out.println(object);
+	}
+
+	@Test
+	public void testRemove() {
+		arrayList.add("aaa");
+		arrayList.add("bbb");
+		arrayList.add("ccc");
+		arrayList.add("ddd");
+		arrayList.remove(0);
+		System.out.println(arrayList);
+	}
+
+	@Test
+	public void testSize() {
+		arrayList.add("aaa");
+		arrayList.add("bbb");
+		arrayList.add("ccc");
+		arrayList.add("ddd");
+		System.out.println(arrayList.size());
+	}
+
+}
diff --git a/group16/420355244/Homework1/src/com/coding/basic/BinaryTreeNode.java b/group16/420355244/Homework1/src/com/coding/basic/BinaryTreeNode.java
new file mode 100644
index 0000000000..d7ac820192
--- /dev/null
+++ b/group16/420355244/Homework1/src/com/coding/basic/BinaryTreeNode.java
@@ -0,0 +1,32 @@
+package com.coding.basic;
+
+public class BinaryTreeNode {
+	
+	private Object data;
+	private BinaryTreeNode left;
+	private BinaryTreeNode right;
+	
+	public Object getData() {
+		return data;
+	}
+	public void setData(Object data) {
+		this.data = data;
+	}
+	public BinaryTreeNode getLeft() {
+		return left;
+	}
+	public void setLeft(BinaryTreeNode left) {
+		this.left = left;
+	}
+	public BinaryTreeNode getRight() {
+		return right;
+	}
+	public void setRight(BinaryTreeNode right) {
+		this.right = right;
+	}
+	
+	public BinaryTreeNode insert(Object o){
+		return  null;
+	}
+	
+}
diff --git a/group16/420355244/Homework1/src/com/coding/basic/Iterator.java b/group16/420355244/Homework1/src/com/coding/basic/Iterator.java
new file mode 100644
index 0000000000..06ef6311b2
--- /dev/null
+++ b/group16/420355244/Homework1/src/com/coding/basic/Iterator.java
@@ -0,0 +1,7 @@
+package com.coding.basic;
+
+public interface Iterator {
+	public boolean hasNext();
+	public Object next();
+
+}
diff --git a/group16/420355244/Homework1/src/com/coding/basic/LinkedList.java b/group16/420355244/Homework1/src/com/coding/basic/LinkedList.java
new file mode 100644
index 0000000000..9af35a399d
--- /dev/null
+++ b/group16/420355244/Homework1/src/com/coding/basic/LinkedList.java
@@ -0,0 +1,224 @@
+package com.coding.basic;
+
+import java.util.NoSuchElementException;
+
+public class LinkedList implements List {
+	
+	
+	private Node first;
+	
+	private Node last;
+	
+	private int size = 0;
+	
+	public void add(Object o){
+		if(null == first){
+			//当链表元素为空时，新建一个Node
+			Node node = new Node();
+			node.data = o;
+			node.next = null;
+			first = node;
+			last = node;
+			size ++;
+		}else{
+			addLast(o);
+		}
+	}
+	public void add(int index , Object o){
+		if(index < 0 || index >= size){
+			//数组越界异常
+			throw new IndexOutOfBoundsException();
+		}else{
+			if(0 == index){
+				//1.如果加在头上
+				addFirst(o);
+			}else{
+				//2.加在中间位置
+				Node node = first.next;
+				int nodeIndex = 1;
+				if(nodeIndex == index){
+					//如果是第二个位置的话
+					Node nodeAdd = new Node();
+					nodeAdd.data = o;
+					first.next = nodeAdd;
+					nodeAdd.next = node;
+					last = node;
+					size ++;
+				}
+				//第三个位置及以后、开始遍历所有的索引
+				while(null != node.next){
+					//保留遍历中node之前的结点
+					Node nodeLast = node;
+					node = node.next;
+					nodeIndex++;
+					if(nodeIndex == index){
+						Node nodeAdd = new Node();
+						nodeAdd.data = o;
+						nodeLast.next = nodeAdd;
+						nodeAdd.next = node;
+						size ++;
+						break;
+					}
+				}
+			}
+		}
+		
+	}
+	public Object get(int index){
+		if(index < 0 || index >= size){
+			//数组越界异常
+			throw new IndexOutOfBoundsException();
+		}else{
+			if(0 == index){
+				//1.如果加在头上
+				return first.data;
+			}
+			Node node = first.next;
+			int nodeIndex = 1;
+			if(nodeIndex == index){
+				//如果是第二个位置的话
+				return node.data;
+			}
+			//第三个位置及以后、开始遍历所有的索引
+			while(null != node.next){
+				//保留遍历中node之前的结点
+				node = node.next;
+				nodeIndex++;
+				if(nodeIndex == index){
+					return node.data;
+				}
+			}
+		}
+		throw new IndexOutOfBoundsException();
+	}
+	public Object remove(int index){
+		if(index < 0 || index >= size){
+			//数组越界异常
+			throw new IndexOutOfBoundsException();
+		}else{
+			if(0 == index){
+				//1.如果移除头
+				removeFirst();
+			}else if(index == (size - 1)){
+				//2.移除尾
+				removeLast();
+			}else{
+				//3.移除中间位置
+				Node node = first.next;
+				//从first的零号索引开始
+				int nodeIndex = 1;
+				
+				//开始遍历所有的索引，记住要移除的索引位数据的前后结点
+				Node lastNode = first;
+				if(index == nodeIndex){
+					//第一次不匹配则后续的循环执行
+					Object o = node.data;
+					lastNode.next = node.next;
+					size--;
+					return o;
+				}else{
+					while(null != node.next){
+						lastNode = node;
+						node = node.next;
+						nodeIndex++;
+						if(index == nodeIndex){
+							Object o = node.data;
+							lastNode.next = node.next;
+							size--;
+							return o;
+						}
+					}
+				}
+			}
+		}
+		throw new IndexOutOfBoundsException();
+	}
+	
+	public int size(){
+		return size;
+	}
+	
+	public void addFirst(Object o){
+		Node node = new Node();
+		node.data = o ;
+		node.next = first;
+		first = node;
+		size++;
+	}
+	public void addLast(Object o){
+		Node node = new Node();
+		node.data = o ;
+		node.next = null;
+		last.next = node;
+		last = node;
+		size++;
+	}
+	public Object removeFirst(){
+		Object o = first.data;
+		Node node = first.next;
+		first = node;
+		size--;
+		return o;
+	}
+	public Object removeLast(){
+		if(0 == size){
+			throw new NoSuchElementException();
+			
+		}else if(1 == size){
+			//只有一个元素
+			removeFirst();
+		}else{
+			//第二个元素
+			Node node = first.next;
+			if(null == node.next){
+				Object o = node.data;
+				last = first;
+				first.next = null;
+				return o;
+			}else{
+				while(null != node.next){
+					//若不止只有2个 ，记录最后一个结点的前一个。
+					Node lastNode = node;
+					node = node.next;
+					if(null == node.next){
+						Object o = node.data;
+						lastNode.next = null;
+						last = lastNode;
+						size--;
+						return o;
+					}
+				}
+			}
+		}
+		throw new NoSuchElementException();
+	}
+	public Iterator iterator(){
+		return null;
+	}
+	
+	
+	private static  class Node{
+		Object data;
+		Node next;
+		
+	}
+
+
+	@Override
+	public String toString() {
+		StringBuilder sb = new StringBuilder();
+		if(null != first){
+			sb.append(first.data.toString() + ",");
+			Node node = first.next;
+			sb.append(node.data.toString() + ",");
+			while(null != node.next){
+				node = node.next;
+				sb.append(node.data.toString() + ",");
+			}
+		}
+		return sb.toString();
+	}
+
+
+	
+}
diff --git a/group16/420355244/Homework1/src/com/coding/basic/LinkedListTest.java b/group16/420355244/Homework1/src/com/coding/basic/LinkedListTest.java
new file mode 100644
index 0000000000..2caea9679b
--- /dev/null
+++ b/group16/420355244/Homework1/src/com/coding/basic/LinkedListTest.java
@@ -0,0 +1,112 @@
+package com.coding.basic;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class LinkedListTest {
+	private static LinkedList linkedList = new LinkedList();
+	@Before
+	public void setUp() throws Exception {
+	}
+
+	@Test
+	public void testAddObject() {
+		linkedList.add("aaa");
+		linkedList.add("bbb");
+		System.out.println(linkedList);
+	}
+
+	@Test
+	public void testAddIntObject() {
+		linkedList.add("aaa");
+		linkedList.add("bbb");
+		linkedList.add("ccc");
+		linkedList.add(2,"ddd");
+		System.out.println(linkedList);
+		System.out.println(linkedList.size());
+	}
+
+	@Test
+	public void testGet() {
+		linkedList.add("aaa");
+		linkedList.add("bbb");
+		linkedList.add("ccc");
+		linkedList.add("eee");
+		linkedList.add("fff");
+		linkedList.add("ddd");
+//		System.out.println(linkedList.size());
+		System.out.println(linkedList.get(3));
+	}
+
+	@Test
+	public void testRemove() {
+		linkedList.add("aaa");
+		linkedList.add("bbb");
+		linkedList.add("ccc");
+		linkedList.add("eee");
+		linkedList.add("fff");
+		linkedList.add("ddd");
+		linkedList.remove(5);
+		linkedList.remove(1);
+		linkedList.remove(2);
+		System.out.println(linkedList);
+		System.out.println(linkedList.size());
+	}
+
+	@Test
+	public void testSize() {
+		linkedList.add("aaa");
+		linkedList.add("bbb");
+		linkedList.add("ccc");
+		linkedList.add("eee");
+		linkedList.add("fff");
+		linkedList.add("ddd");
+		System.out.println(linkedList.size());
+	}
+
+	@Test
+	public void testAddFirst() {
+		linkedList.add("aaa");
+		linkedList.add("bbb");
+		linkedList.addFirst("sss");
+		System.out.println(linkedList);
+	}
+
+	@Test
+	public void testAddLast() {
+		linkedList.add("aaa");
+		linkedList.add("bbb");
+		linkedList.add("ccc");
+		System.out.println(linkedList);
+	}
+
+	@Test
+	public void testRemoveFirst() {
+		linkedList.add("aaa");
+		linkedList.add("bbb");
+		linkedList.add("ccc");
+		linkedList.removeFirst();
+		linkedList.addFirst("eee");
+		linkedList.removeFirst();
+		System.out.println(linkedList);
+	}
+
+	@Test
+	public void testRemoveLast() {
+		linkedList.add("aaa");
+		linkedList.add("bbb");
+		linkedList.add("ccc");
+		linkedList.removeLast();
+		linkedList.add("eee");
+		linkedList.addFirst("xxx");
+		System.out.println(linkedList);
+	}
+
+	@Test
+	public void testIterator() {
+		fail("Not yet implemented");
+	}
+
+}
diff --git a/group16/420355244/Homework1/src/com/coding/basic/List.java b/group16/420355244/Homework1/src/com/coding/basic/List.java
new file mode 100644
index 0000000000..10d13b5832
--- /dev/null
+++ b/group16/420355244/Homework1/src/com/coding/basic/List.java
@@ -0,0 +1,9 @@
+package com.coding.basic;
+
+public interface List {
+	public void add(Object o);
+	public void add(int index, Object o);
+	public Object get(int index);
+	public Object remove(int index);
+	public int size();
+}
diff --git a/group16/420355244/Homework1/src/com/coding/basic/Queue.java b/group16/420355244/Homework1/src/com/coding/basic/Queue.java
new file mode 100644
index 0000000000..a2f9577b7b
--- /dev/null
+++ b/group16/420355244/Homework1/src/com/coding/basic/Queue.java
@@ -0,0 +1,66 @@
+package com.coding.basic;
+
+public class Queue {
+	private Node first;
+	private Node last;
+	private int size = 0;
+	public void enQueue(Object o){	
+		if(null == first){
+			Node node = new Node();
+			node.data = o;
+			node.next = null;
+			first = node;
+			last = node;
+		}else{
+			Node node = new Node();
+			node.data = o;
+			node.next = null;
+			last.next = node;
+			last = node;
+		}
+		size++;
+	}
+	
+	public Object deQueue(){
+		Node second = first.next;
+		Object o = first.data;
+		if(null != second){
+			first = second;
+			return o;
+		}else{
+			first = null;
+			size = 0;
+			return o;
+		}
+	}
+	
+	public boolean isEmpty(){
+		if(size > 0){
+			return false;
+		}else{
+			return true;
+		}
+	}
+	
+	public int size(){
+		return size;
+	}
+	static class Node{
+		Node next;
+		Object data;
+	}
+	@Override
+	public String toString() {
+		StringBuilder sb = new StringBuilder();
+		if(null != first){
+			sb.append(first.data.toString() + ",");
+			Node node = first.next;
+			sb.append(node.data.toString() + ",");
+			while(null != node.next){
+				node = node.next;
+				sb.append(node.data.toString() + ",");
+			}
+		}
+		return sb.toString();
+	}
+}
diff --git a/group16/420355244/Homework1/src/com/coding/basic/QueueTest.java b/group16/420355244/Homework1/src/com/coding/basic/QueueTest.java
new file mode 100644
index 0000000000..50d7fc0903
--- /dev/null
+++ b/group16/420355244/Homework1/src/com/coding/basic/QueueTest.java
@@ -0,0 +1,56 @@
+package com.coding.basic;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class QueueTest {
+
+	public static Queue queue = new Queue();
+	@Before
+	public void setUp() throws Exception {
+	}
+
+	@Test
+	public void testEnQueue() {
+		queue.enQueue("aaa");
+		queue.enQueue("bbb");
+		queue.enQueue("ccc");
+		queue.enQueue("aaa");
+		System.out.println(queue);
+	}
+
+	@Test
+	public void testDeQueue() {
+		queue.enQueue("aaa");
+		queue.enQueue("bbb");
+		queue.enQueue("ccc");
+		queue.enQueue("ddd");
+		queue.enQueue("eee");
+		queue.deQueue();
+		System.out.println(queue);
+	}
+
+	@Test
+	public void testIsEmpty() {
+		System.out.println(queue.isEmpty());
+		
+	}
+
+	@Test
+	public void testSize() {
+		queue.enQueue("aaa");
+		queue.enQueue("bbb");
+		queue.enQueue("ccc");
+		queue.enQueue("ddd");
+		queue.enQueue("eee");
+		System.out.println(queue.size());
+	}
+
+	@Test
+	public void testToString() {
+		fail("Not yet implemented");
+	}
+
+}
diff --git a/group16/420355244/Homework1/src/com/coding/basic/Stack.java b/group16/420355244/Homework1/src/com/coding/basic/Stack.java
new file mode 100644
index 0000000000..5c59bf34fc
--- /dev/null
+++ b/group16/420355244/Homework1/src/com/coding/basic/Stack.java
@@ -0,0 +1,39 @@
+package com.coding.basic;
+
+public class Stack {
+	private ArrayList elementData = new ArrayList();
+	private int size = 0;
+	public void push(Object o){	
+		//入栈在栈顶进入最后压入
+		elementData.add(o);
+		size ++;
+	}
+	
+	public Object pop(){
+		Object object = elementData.get(size -1);
+		elementData.remove(size -1);
+		size --;
+		return object;
+	}
+	
+	public Object peek(){
+		Object object = elementData.get(size -1);
+		return object;
+	}
+	public boolean isEmpty(){
+		if(size <= 0){
+			return true;
+		}else{
+			return false;
+		}
+	}
+	public int size(){
+		return size;
+	}
+
+	@Override
+	public String toString() {
+		return elementData.toString();
+	}
+	
+}
diff --git a/group16/420355244/Homework1/src/com/coding/basic/StackTest.java b/group16/420355244/Homework1/src/com/coding/basic/StackTest.java
new file mode 100644
index 0000000000..b436785574
--- /dev/null
+++ b/group16/420355244/Homework1/src/com/coding/basic/StackTest.java
@@ -0,0 +1,62 @@
+package com.coding.basic;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class StackTest {
+	private static Stack stack = new Stack();
+	@Before
+	public void setUp() throws Exception {
+	}
+
+	@Test
+	public void testPush() {
+		stack.push("aaa");
+		stack.push("bbb");
+		stack.push("ccc");
+		System.out.println(stack);
+	}
+
+	@Test
+	public void testPop() {
+		stack.push("aaa");
+		stack.push("bbb");
+		stack.push("ccc");
+		Object pop = stack.pop();
+		System.out.println(pop);
+		System.out.println(stack);
+	}
+
+	@Test
+	public void testPeek() {
+		stack.push("aaa");
+		stack.push("bbb");
+		stack.push("ccc");
+		Object peek = stack.peek();
+		System.out.println(peek);
+	}
+
+	@Test
+	public void testIsEmpty() {
+		System.out.println(stack.isEmpty());
+		stack.push("aaa");
+		stack.push("bbb");
+		stack.push("ccc");
+		System.out.println(stack.isEmpty());
+		stack.pop();
+		stack.pop();
+		stack.pop();
+		System.out.println(stack.isEmpty());
+	}
+
+	@Test
+	public void testSize() {
+		stack.push("aaa");
+		stack.push("bbb");
+		stack.push("ccc");
+		stack.pop();
+		stack.pop();
+		System.out.println(stack.size());
+	}
+
+}

From e6c1f6d2b359745ac8062a5a2d83f1857d0ffeae Mon Sep 17 00:00:00 2001
From: starlight0405 <ang505@163.com>
Date: Wed, 1 Mar 2017 22:14:06 +0800
Subject: [PATCH 21/36] second code

---
 .../src/com/coderising/array/ArrayUtil.java   | 258 ++++++++++++++++++
 .../com/coderising/litestruts/ActionXml.java  |  37 +++
 .../coderising/litestruts/LoginAction.java    |  39 +++
 .../src/com/coderising/litestruts/Struts.java | 150 ++++++++++
 .../com/coderising/litestruts/StrutsTest.java |  43 +++
 .../src/com/coderising/litestruts/View.java   |  23 ++
 .../src/com/coderising/litestruts/struts.xml  |  11 +
 7 files changed, 561 insertions(+)
 create mode 100644 group16/2816977791/secondExercise/src/com/coderising/array/ArrayUtil.java
 create mode 100644 group16/2816977791/secondExercise/src/com/coderising/litestruts/ActionXml.java
 create mode 100644 group16/2816977791/secondExercise/src/com/coderising/litestruts/LoginAction.java
 create mode 100644 group16/2816977791/secondExercise/src/com/coderising/litestruts/Struts.java
 create mode 100644 group16/2816977791/secondExercise/src/com/coderising/litestruts/StrutsTest.java
 create mode 100644 group16/2816977791/secondExercise/src/com/coderising/litestruts/View.java
 create mode 100644 group16/2816977791/secondExercise/src/com/coderising/litestruts/struts.xml

diff --git a/group16/2816977791/secondExercise/src/com/coderising/array/ArrayUtil.java b/group16/2816977791/secondExercise/src/com/coderising/array/ArrayUtil.java
new file mode 100644
index 0000000000..3572229739
--- /dev/null
+++ b/group16/2816977791/secondExercise/src/com/coderising/array/ArrayUtil.java
@@ -0,0 +1,258 @@
+package com.coderising.array;
+
+public class ArrayUtil {
+
+    /**
+     * 给定一个整形数组a , 对该数组的值进行置换
+     * 例如： a = [7, 9 , 30, 3]  ,   置换后为 [3, 30, 9,7]
+     * 如果     a = [7, 9, 30, 3, 4] , 置换后为 [4,3, 30 , 9,7]
+     *
+     * @param origin
+     * @return
+     */
+    public void reverseArray(int[] origin) {
+        int i = 0;
+        while (i < origin.length - 1 - i) {
+            int temp = origin[origin.length - 1 - i];
+            origin[origin.length - 1 - i] = origin[i];
+            origin[i] = temp;
+            i++;
+        }
+    }
+
+    /**
+     * 现在有如下的一个数组：   int oldArr[]={1,3,4,5,0,0,6,6,0,5,4,7,6,7,0,5}
+     * 要求将以上数组中值为0的项去掉，将不为0的值存入一个新的数组，生成的新数组为：
+     * {1,3,4,5,6,6,5,4,7,6,7,5}
+     *
+     * @param oldArray
+     * @return
+     */
+
+    public int[] removeZero(int[] oldArray) {
+        int point = 0;
+        for (int i : oldArray) {
+            if (i != 0) {
+                oldArray[point++] = i;
+            }
+        }
+        int[] newArray = new int[point];
+        System.arraycopy(oldArray, 0, newArray, 0, point);
+        return newArray;
+    }
+
+    /**
+     * 给定两个已经排序好的整形数组， a1和a2 ,  创建一个新的数组a3, 使得a3 包含a1和a2 的所有元素， 并且仍然是有序的
+     * 例如 a1 = [3, 5, 7,8]   a2 = [4, 5, 6,7]    则 a3 为[3,4,5,6,7,8]    , 注意： 已经消除了重复
+     *
+     * @param array1
+     * @param array2
+     * @return
+     */
+
+    public int[] merge(int[] array1, int[] array2) {
+        //两个指针
+        int pos1 = 0;
+        int pos2 = 0;
+        int point = 0;
+        int[] newArray = new int[array1.length + array2.length];
+        while (pos1 < array1.length && pos2 < array2.length) {
+            if (array1[pos1] > array2[pos2]) {
+                newArray[point++] = array2[pos2++];
+            } else if (array1[pos1] < array2[pos2]) {
+                newArray[point++] = array1[pos1++];
+            } else {
+                newArray[point++] = array1[pos1++];
+                pos2++;
+            }
+        }
+        while (pos1 < array1.length) {
+            newArray[point++] = array1[pos1++];
+        }
+        while (pos1 < array2.length) {
+            newArray[point++] = array1[pos2++];
+        }
+        int[] array = new int[point];
+        System.arraycopy(newArray, 0, array, 0, point);
+        return array;
+    }
+
+    /**
+     * 把一个已经存满数据的数组 oldArray的容量进行扩展， 扩展后的新数据大小为oldArray.length + size
+     * 注意，老数组的元素在新数组中需要保持
+     * 例如 oldArray = [2,3,6] , size = 3,则返回的新数组为
+     * [2,3,6,0,0,0]
+     *
+     * @param oldArray
+     * @param size
+     * @return
+     */
+    public int[] grow(int[] oldArray, int size) {
+        int[] newArray = new int[oldArray.length + size];
+        System.arraycopy(oldArray, 0, newArray, 0, oldArray.length);
+        return newArray;
+    }
+
+    /**
+     * 斐波那契数列为：1，1，2，3，5，8，13，21......  ，给定一个最大值， 返回小于该值的数列
+     * 例如， max = 15 , 则返回的数组应该为 [1，1，2，3，5，8，13]
+     * max = 1, 则返回空数组 []
+     *
+     * @param max
+     * @return
+     */
+    public int[] fibonacci(int max) {
+        int a = 0;
+        int b = 1;
+        int[] array = new int[max];
+        int i = 0;
+        if (max >= 2) {
+            array[i++] = 1;
+        }
+        while (a + b < max) {
+            int temp = b;
+            b = a + b;
+            a = temp;
+            array[i++] = b;
+        }
+        int[] newArray = new int[i];
+        System.arraycopy(array, 0, newArray, 0, i);
+        return newArray;
+    }
+
+    /**
+     * 返回小于给定最大值max的所有素数数组
+     * 例如max = 23, 返回的数组为[2,3,5,7,11,13,17,19]
+     *
+     * @param max
+     * @return
+     */
+    public int[] getPrimes(int max) {
+        int[] array = new int[max / 2 + 1];
+        int pos = 0;
+        for (int i = 1; i < max; i++) {
+            if (prime(i)) {
+                array[pos++] = i;
+            }
+        }
+        int[] newArray = new int[pos];
+        System.arraycopy(array, 0, newArray, 0, pos);
+        return newArray;
+    }
+
+    private boolean prime(int value) {
+        if (value < 2) {
+            return false;
+        } else if (value == 2) {
+            return true;
+        } else {
+            for (int i = 2; i < value / 2 + 1; i++) {
+                if (value % 2 == 0) {
+                    return false;
+                }
+            }
+            return true;
+        }
+    }
+
+    /**
+     * 所谓“完数”， 是指这个数恰好等于它的因子之和，例如6=1+2+3
+     * 给定一个最大值max， 返回一个数组， 数组中是小于max 的所有完数
+     *
+     * @param max
+     * @return
+     */
+    public int[] getPerfectNumbers(int max) {
+        int pos = 0;
+        int[] array = new int[max];
+        for (int i = 1; i < max; i++) {
+            if (perfectNumber(i)) {
+                array[pos++] = i;
+            }
+        }
+        int[] newArray = new int[pos];
+        System.arraycopy(array, 0, newArray, 0, pos);
+        return newArray;
+    }
+
+    private boolean perfectNumber(int value) {
+        if (value == 1 || prime(value)) {
+            return false;
+        } else {
+            int sum = 0;
+            for (int i = 1; i <= value / 2; i++) {
+                if (value % i == 0) {
+                    sum += i;
+                }
+            }
+            if (sum == value) {
+                return true;
+            }
+            return false;
+        }
+    }
+
+    /**
+     * 用seperator 把数组 array给连接起来
+     * 例如array= [3,8,9], seperator = "-"
+     * 则返回值为"3-8-9"
+     *
+     * @param array
+     * @param seperator
+     * @return
+     */
+    public String join(int[] array, String seperator) {
+        String out = "";
+        for (int i = 0; i < array.length; i++) {
+            if (i == 0) {
+                out += String.valueOf(i);
+            } else {
+                out += seperator + String.valueOf(i);
+            }
+        }
+        return out;
+    }
+
+
+    public static void main(String[] args) {
+        ArrayUtil arrayUtil = new ArrayUtil();
+        //reverse
+        int[] a = {7, 9, 30, 3};
+        arrayUtil.reverseArray(a);
+        System.out.println(a);
+
+        //remove zero
+        int[] zero = {1, 3, 4, 5, 0, 0, 6, 6, 0, 5, 4, 7, 6, 7, 0, 5};
+        int[] afterZero = arrayUtil.removeZero(zero);
+        System.out.println(afterZero);
+
+        //merge
+        int[] a1 = {3, 5, 7, 8};
+        int[] a2 = {4, 5, 6, 7};
+        int[] merge = arrayUtil.merge(a1, a2);
+        System.out.println(merge);
+
+        //grow
+        int[] oldArray = {2, 3, 6};
+        int[] grow = arrayUtil.grow(oldArray, 3);
+        System.out.println(grow);
+
+        //fibonacci
+        int[] fibonacci = arrayUtil.fibonacci(2);
+        System.out.println(fibonacci);
+
+        //primes
+        int[] primes = arrayUtil.getPrimes(15);
+        System.out.println(primes);
+
+        //perfect
+        int[] perfect = arrayUtil.getPerfectNumbers(500);
+        System.out.println(perfect);
+
+        //join
+        int[] joinArray = {2};
+        String join = arrayUtil.join(joinArray, "-");
+        System.out.println(join);
+
+    }
+}
diff --git a/group16/2816977791/secondExercise/src/com/coderising/litestruts/ActionXml.java b/group16/2816977791/secondExercise/src/com/coderising/litestruts/ActionXml.java
new file mode 100644
index 0000000000..55988befbe
--- /dev/null
+++ b/group16/2816977791/secondExercise/src/com/coderising/litestruts/ActionXml.java
@@ -0,0 +1,37 @@
+package com.coderising.litestruts;
+
+import java.util.Map;
+
+/**
+ * @author nvarchar
+ *         date 2017/3/1
+ */
+public class ActionXml {
+    private String name;
+    private String className;
+    private Map<String, String> map;
+
+    public String getClassName() {
+        return className;
+    }
+
+    public void setClassName(String className) {
+        this.className = className;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Map<String, String> getMap() {
+        return map;
+    }
+
+    public void setMap(Map<String, String> map) {
+        this.map = map;
+    }
+}
diff --git a/group16/2816977791/secondExercise/src/com/coderising/litestruts/LoginAction.java b/group16/2816977791/secondExercise/src/com/coderising/litestruts/LoginAction.java
new file mode 100644
index 0000000000..1005f35a29
--- /dev/null
+++ b/group16/2816977791/secondExercise/src/com/coderising/litestruts/LoginAction.java
@@ -0,0 +1,39 @@
+package com.coderising.litestruts;
+
+/**
+ * 这是一个用来展示登录的业务类， 其中的用户名和密码都是硬编码的。
+ * @author liuxin
+ *
+ */
+public class LoginAction{
+    private String name ;
+    private String password;
+    private String message;
+
+    public String getName() {
+        return name;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public String execute(){
+            if("test".equals(name) && "1234".equals(password)){
+                this.message = "login successful";
+                return "success";
+            }
+            this.message = "login failed,please check your user/pwd";
+            return "fail";
+    }
+
+    public void setName(String name){
+        this.name = name;
+    }
+    public void setPassword(String password){
+        this.password = password;
+    }
+    public String getMessage(){
+        return this.message;
+    }
+}
diff --git a/group16/2816977791/secondExercise/src/com/coderising/litestruts/Struts.java b/group16/2816977791/secondExercise/src/com/coderising/litestruts/Struts.java
new file mode 100644
index 0000000000..f169cb1cbb
--- /dev/null
+++ b/group16/2816977791/secondExercise/src/com/coderising/litestruts/Struts.java
@@ -0,0 +1,150 @@
+package com.coderising.litestruts;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+
+public class Struts {
+
+    private static Map<String, ActionXml> actionXmlMap;
+
+    static {
+        //0. 读取配置文件struts.xml
+        actionXmlMap = parserXml("src/com/coderising/litestruts/struts.xml");
+        System.out.println("parse end");
+    }
+
+    public static View runAction(String actionName, Map<String, String> parameters) {
+
+        try {
+            ActionXml actionXml = actionXmlMap.get(actionName);
+            if (actionName == null) {
+                return null;
+            } else {
+                String className = actionXml.getClassName();
+                Class cls = Class.forName(className);
+                Object obj = cls.newInstance();
+                /**
+                 根据actionName找到相对应的class ， 例如LoginAction,   通过反射实例化（创建对象）
+                 据parameters中的数据，调用对象的setter方法， 例如parameters中的数据是
+                 ("name"="test" ,  "password"="1234") ,
+                 那就应该调用 setName和setPassword方法
+                 */
+                Method[] methods = cls.getMethods();
+                for (String field : parameters.keySet()) {
+                    for (Method method : methods) {
+                        if (method.getName().startsWith("set") && method.getName().toLowerCase().endsWith(field.toLowerCase())) {
+                            method.invoke(obj, parameters.get(field));
+                            break;
+                        }
+                    }
+                }
+                Method action = cls.getMethod("execute");
+                //通过反射调用对象的exectue 方法， 并获得返回值，例如"success"
+                String result = (String) action.invoke(obj);
+                /**
+                 通过反射找到对象的所有getter方法（例如 getMessage）,
+                 通过反射来调用， 把值和属性形成一个HashMap , 例如 {"message":  "登录成功"} ,
+                 放到View对象的parameters
+                 */
+                Field[] fields = cls.getDeclaredFields();
+                Map<String, Object> params = new HashMap<>();
+                for (Field field : fields) {
+                    for (Method method : methods) {
+                        if (method.getName().startsWith("get") && method.getName().toLowerCase().endsWith(field.getName().toLowerCase())) {
+                            String viewResult = (String) method.invoke(obj);
+                            params.put(field.getName(), viewResult);
+                            break;
+                        }
+                    }
+                }
+                /**
+                 根据struts.xml中的 <result> 配置,以及execute的返回值，  确定哪一个jsp，
+                 放到View对象的jsp字段中。
+                 */
+                View view = new View();
+                view.setParameters(params);
+                view.setJsp(actionXmlMap.get(actionName).getMap().get(result));
+                return view;
+            }
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+            return null;
+        } catch (InstantiationException e) {
+            e.printStackTrace();
+            return null;
+        } catch (IllegalAccessException e) {
+            e.printStackTrace();
+            return null;
+        } catch (NoSuchMethodException e) {
+            e.printStackTrace();
+            return null;
+        } catch (InvocationTargetException e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    //解析xml文件
+    private static Map<String, ActionXml> parserXml(String fileName) {
+        try {
+            Map<String, ActionXml> map = new HashMap<>();
+            //create documentBuilder
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            //create document
+            Document document = db.parse(fileName);
+            //extract root element
+            Element root = document.getDocumentElement();
+            System.out.println("Root element :" + document.getDocumentElement().getNodeName());
+            NodeList nodeList = document.getElementsByTagName("action");
+            System.out.println("----------------------------");
+            for (int temp = 0; temp < nodeList.getLength(); temp++) {
+                Node nNode = nodeList.item(temp);
+                System.out.println("\nCurrent Element :"
+                    + nNode.getNodeName());
+                if (nNode.getNodeType() == Node.ELEMENT_NODE) {
+                    ActionXml actionXml = new ActionXml();
+                    Element eElement = (Element) nNode;
+                    System.out.println("action name : "
+                        + eElement.getAttribute("name"));
+                    System.out.println("class name : "
+                        + eElement.getAttribute("class"));
+                    actionXml.setName(eElement.getAttribute("name"));
+                    actionXml.setClassName(eElement.getAttribute("class"));
+                    NodeList result = eElement.getElementsByTagName("result");
+                    Map<String, String> results = new HashMap<>();
+                    for (int i = 0; i < result.getLength(); i++) {
+                        Node resultNode = result.item(i);
+                        if (resultNode.getNodeType() == Node.ELEMENT_NODE) {
+                            Element resultElement = (Element) resultNode;
+                            System.out.println("result name:" + resultElement.getAttribute("name"));
+                            System.out.println("result context:" + resultElement.getTextContent());
+                            results.put(resultElement.getAttribute("name"), resultElement.getTextContent());
+                        }
+                        actionXml.setMap(results);
+                    }
+                    map.put(actionXml.getName(), actionXml);
+                }
+            }
+            return map;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    public static void main(String[] args) {
+//        parserXml("src/com/coderising/litestruts/struts.xml");
+    }
+}
diff --git a/group16/2816977791/secondExercise/src/com/coderising/litestruts/StrutsTest.java b/group16/2816977791/secondExercise/src/com/coderising/litestruts/StrutsTest.java
new file mode 100644
index 0000000000..a44c1878ac
--- /dev/null
+++ b/group16/2816977791/secondExercise/src/com/coderising/litestruts/StrutsTest.java
@@ -0,0 +1,43 @@
+package com.coderising.litestruts;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+
+
+
+
+public class StrutsTest {
+
+	@Test
+	public void testLoginActionSuccess() {
+		
+		String actionName = "login";
+        
+		Map<String,String> params = new HashMap<String,String>();
+        params.put("name","test");
+        params.put("password","1234");
+        
+        
+        View view  = Struts.runAction(actionName,params);        
+        
+        Assert.assertEquals("/jsp/homepage.jsp", view.getJsp());
+        Assert.assertEquals("login successful", view.getParameters().get("message"));
+	}
+
+	@Test
+	public void testLoginActionFailed() {
+		String actionName = "login";
+		Map<String,String> params = new HashMap<String,String>();
+        params.put("name","test");
+        params.put("password","123456"); //密码和预设的不一致
+        
+        View view  = Struts.runAction(actionName,params);        
+        
+        Assert.assertEquals("/jsp/showLogin.jsp", view.getJsp());
+        Assert.assertEquals("login failed,please check your user/pwd", view.getParameters().get("message"));
+	}
+}
diff --git a/group16/2816977791/secondExercise/src/com/coderising/litestruts/View.java b/group16/2816977791/secondExercise/src/com/coderising/litestruts/View.java
new file mode 100644
index 0000000000..0194c681f6
--- /dev/null
+++ b/group16/2816977791/secondExercise/src/com/coderising/litestruts/View.java
@@ -0,0 +1,23 @@
+package com.coderising.litestruts;
+
+import java.util.Map;
+
+public class View {
+	private String jsp;
+	private Map parameters;
+	
+	public String getJsp() {
+		return jsp;
+	}
+	public View setJsp(String jsp) {
+		this.jsp = jsp;
+		return this;
+	}
+	public Map getParameters() {
+		return parameters;
+	}
+	public View setParameters(Map parameters) {
+		this.parameters = parameters;
+		return this;
+	}
+}
diff --git a/group16/2816977791/secondExercise/src/com/coderising/litestruts/struts.xml b/group16/2816977791/secondExercise/src/com/coderising/litestruts/struts.xml
new file mode 100644
index 0000000000..246b3595ad
--- /dev/null
+++ b/group16/2816977791/secondExercise/src/com/coderising/litestruts/struts.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<struts>
+    <action name="login" class="com.coderising.litestruts.LoginAction">
+        <result name="success">/jsp/homepage.jsp</result>
+        <result name="fail">/jsp/showLogin.jsp</result>
+    </action>
+    <action name="logout" class="com.coderising.litestruts.LogoutAction">
+    	<result name= "success">/jsp/welcome.jsp</result>
+    	<result name= "error">/jsp/error.jsp</result>
+    </action>
+</struts>
\ No newline at end of file

From 3fd1841d683cc4b2e8971f1b25cfc0300c374d9a Mon Sep 17 00:00:00 2001
From: gaodekui <13526428940@163.com>
Date: Thu, 2 Mar 2017 09:10:16 +0800
Subject: [PATCH 22/36] =?UTF-8?q?=E6=8F=90=E4=BA=A4ArrayUtil?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../src/com/list20170226/ArrayUtil.java       | 276 ++++++++++++++++++
 1 file changed, 276 insertions(+)
 create mode 100644 group16/1154151360/src/com/list20170226/ArrayUtil.java

diff --git a/group16/1154151360/src/com/list20170226/ArrayUtil.java b/group16/1154151360/src/com/list20170226/ArrayUtil.java
new file mode 100644
index 0000000000..a09c544787
--- /dev/null
+++ b/group16/1154151360/src/com/list20170226/ArrayUtil.java
@@ -0,0 +1,276 @@
+package com.list20170226;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import com.sun.org.apache.xalan.internal.xsltc.compiler.sym;
+
+public class ArrayUtil {
+
+	/**
+	 * 给定一个整形数组a , 对该数组的值进行置换
+		例如： a = [7, 9 , 30, 3]  ,   置换后为 [3, 30, 9,7]
+		如果     a = [7, 9, 30, 3, 4] , 置换后为 [4,3, 30 , 9,7]
+	 * @param origin
+	 * @return
+	 */
+	public void reverseArray(int[] origin){
+		
+		int [] temp = new int [origin.length];
+		
+		for (int i = 0; i < temp.length; i++){
+			temp [i] = origin [temp.length - 1 - i];
+		}
+		
+		origin = temp;
+	}
+	
+	/**
+	 * 现在有如下的一个数组：   int oldArr[]={1,3,4,5,0,0,6,6,0,5,4,7,6,7,0,5}   
+	 * 要求将以上数组中值为0的项去掉，将不为0的值存入一个新的数组，生成的新数组为：   
+	 * {1,3,4,5,6,6,5,4,7,6,7,5}  
+	 * @param oldArray
+	 * @return
+	 */
+	
+	public int[] removeZero(int[] oldArray){
+		
+		int newLength = 0;
+		
+		for (int i = 0; i < oldArray.length ; i++){
+			if (oldArray[i] == 0)
+				newLength ++;
+		}
+		
+		int [] newArray = new int [oldArray.length - newLength];
+		int index = 0;
+		for (int j = 0; j < oldArray.length; j++){
+			if (oldArray[j] != 0)
+				newArray[index++] = oldArray[j];
+		}
+		
+		newArray = sort(newArray, 0, newArray.length - 1);
+		return newArray;
+	}
+	
+	/**
+	 * 给定两个已经排序好的整形数组， a1和a2 ,  创建一个新的数组a3, 使得a3 包含a1和a2 的所有元素， 并且仍然是有序的
+	 * 例如 a1 = [3, 5, 7,8]   a2 = [4, 5, 6,7]    则 a3 为[3,4,5,6,7,8]    , 注意： 已经消除了重复
+	 * @param array1
+	 * @param array2
+	 * @return
+	 */
+	
+	public int[] merge(int[] array1, int[] array2){
+		
+		int newLength = array1.length + array2.length;
+		int [] newArray = new int [newLength];
+		System.arraycopy(array1, 0, newArray, 0, array1.length);
+		System.arraycopy(array2, 0, newArray, array1.length, array2.length);
+		Set<Integer> arraySet = new HashSet<Integer>();
+		for (int i = 0; i < newArray.length; i++){
+			arraySet.add(newArray[i]);
+		}
+		int [] tempArray = new int[arraySet.size()];
+		Iterator<Integer> iterator = arraySet.iterator();
+		int index = 0;
+		while (iterator.hasNext()){
+			tempArray[index++] = iterator.next();
+		}
+		newArray = sort(tempArray, 0, tempArray.length - 1);
+		return  newArray;
+	}
+	/**
+	 * 把一个已经存满数据的数组 oldArray的容量进行扩展， 扩展后的新数据大小为oldArray.length + size
+	 * 注意，老数组的元素在新数组中需要保持
+	 * 例如 oldArray = [2,3,6] , size = 3,则返回的新数组为
+	 * [2,3,6,0,0,0]
+	 * @param oldArray
+	 * @param size
+	 * @return
+	 */
+	public int[] grow(int [] oldArray,  int size){
+		int [] newArray = new int[oldArray.length + size];
+		System.arraycopy(oldArray, 0, newArray, 0, size);
+		return newArray;
+	}
+	
+	/**
+	 * 斐波那契数列为：1，1，2，3，5，8，13，21......  ，给定一个最大值， 返回小于该值的数列
+	 * 例如， max = 15 , 则返回的数组应该为 [1，1，2，3，5，8，13]
+	 * max = 1, 则返回空数组 []
+	 * @param max
+	 * @return
+	 */
+	public int[] fibonacci(int max){
+		if (max > 1){
+			List<Integer> array = new ArrayList<Integer>();
+			array.add(1);
+			array.add(1);
+			for(int i = 2;;i++){
+				array.add(array.get(i - 1) + array.get(i - 2));
+				if (array.get(i) > max){
+					array.remove(i);
+					break;
+				}
+			}
+			int [] result = returnArray(array);
+			return result;
+		}else{
+			int [] b = new int[]{};
+			return b;
+		}
+		
+	}
+	
+	/**
+	 * 返回小于给定最大值max的所有素数数组
+	 * 例如max = 23, 返回的数组为[2,3,5,7,11,13,17,19]
+	 * @param max
+	 * @return
+	 */
+	public int[] getPrimes(int max){
+		ArrayList<Integer> list1 = new ArrayList<Integer>();
+		ArrayList<Integer> list2 = new ArrayList<Integer>();
+		for (int i = 2; i < max; i++){
+			list1.add(i);
+		}
+		
+		for (int m = 0; m < list1.size(); m++){
+			boolean flag = true;
+			for (int n = 2; n < list1.get(m); n++){
+				if (list1.get(m) % n == 0){
+					flag = false;
+					break;
+				}
+				
+			}
+			if (flag)
+				list2.add(list1.get(m));
+		}
+		
+		int [] result = returnArray(list2);
+		
+		return result;
+	}
+	
+	/**
+	 * 所谓“完数”， 是指这个数恰好等于它的因子之和，例如6=1+2+3
+	 * 给定一个最大值max， 返回一个数组， 数组中是小于max 的所有完数
+	 * @param max
+	 * @return
+	 */
+	public int[] getPerfectNumbers(int max){
+		ArrayList<Integer> array = new ArrayList<Integer>();
+		Map<Integer, ArrayList<Integer>> arrayMap = new HashMap<Integer, ArrayList<Integer>>();
+		ArrayList<Integer> array2 = new ArrayList<Integer>();
+		for (int i = 2; i < max; i++){
+			array.add(i);
+		}
+		for(int m = 0; m < array.size(); m++){
+			ArrayList<Integer> tempArray = new ArrayList<Integer>();
+			for (int n = 2; n < array.get(m);n++){
+				if (array.get(m) % n == 0)
+					tempArray.add(n);
+			}
+			arrayMap.put(array.get(m), tempArray);
+		}
+		for(Map.Entry<Integer, ArrayList<Integer>> entry: arrayMap.entrySet()){
+			Integer key = entry.getKey();
+			ArrayList<Integer> tempArray = entry.getValue();
+			Integer tempInt = 0;
+			for (Integer i:tempArray){
+				tempInt += i;
+			}
+			if (key == tempInt){
+				array2.add(key);
+			}
+		}
+		int [] result = returnArray(array2);
+		
+		return result;
+	}
+	
+	/**
+	 * 用seperator 把数组 array给连接起来
+	 * 例如array= [3,8,9], seperator = "-"
+	 * 则返回值为"3-8-9"
+	 * @param array
+	 * @param s
+	 * @return
+	 */
+	public String join(int[] array, String seperator){
+		
+		StringBuilder builder = new StringBuilder();
+		
+		for (int i = 0; i < array.length; i++){
+			builder.append(array[i]);
+			builder.append(seperator);
+		}
+		builder.deleteCharAt(builder.length() - 1);
+		return builder.toString();
+	}
+//***************************工具类*****************************************
+	public int [] returnArray( List list){
+		int [] result = new int[list.size()];
+		int index = 0;
+		Iterator<Integer> iterator = list.iterator();
+		while(iterator.hasNext()){
+			result[index++] = iterator.next();
+		}
+		return result;
+	}
+
+	//快速排序算法
+	public int [] sort (int [] array, int low, int height ){
+		
+		int start = low;
+		int end = height;
+		int key = array[low];
+		
+		while (end > start){
+			//从后往前遍历
+			while (end > start && array[end] >= key)
+				end--;
+			
+			if (array[end] <= key){
+				int temp = array[end];
+				array[end] = array[start];
+				array[start] = temp;
+			}
+			
+			//从前往后遍历
+			while(end > start && array[start] <= key)
+				start++;
+			
+			if (array[start] >= key){
+				int temp = array[start];
+				array[start] = array[end];
+				array[end] = temp;
+			}
+		}
+		
+		if(start > low)sort(array, low, start - 1);
+		if (end < height)sort(array, end + 1, height);
+		
+		return array;
+	}
+//******************************************************************8
+public static void main(String[] args) {
+		
+		ArrayUtil util = new ArrayUtil();
+		int [] a1 = {3, 5, 7,8};
+		int [] a2 = {4, 5, 6,7};
+		int [] a3 = util.getPrimes(23);
+		
+		for(int c:a3){
+			System.out.print(c+" ");
+		}
+		
+	}
+}

From 906c758e10204b8873801d27e11f016a3dbdf859 Mon Sep 17 00:00:00 2001
From: duxl <adu1528838@126.com>
Date: Thu, 2 Mar 2017 16:22:50 +0800
Subject: [PATCH 23/36] =?UTF-8?q?=E5=AE=8C=E6=88=90ArrayUtil=E7=BC=96?=
 =?UTF-8?q?=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../src/com/coderising/array/ArrayUtil.java   | 197 ++++++++++++++----
 1 file changed, 153 insertions(+), 44 deletions(-)

diff --git a/group16/1287642108/0305/src/com/coderising/array/ArrayUtil.java b/group16/1287642108/0305/src/com/coderising/array/ArrayUtil.java
index 78845d06d0..8e0d8af87b 100644
--- a/group16/1287642108/0305/src/com/coderising/array/ArrayUtil.java
+++ b/group16/1287642108/0305/src/com/coderising/array/ArrayUtil.java
@@ -1,96 +1,205 @@
 package com.coderising.array;
 
+import java.util.ArrayList;
+
 public class ArrayUtil {
-	
+
 	/**
-	 * 给定一个整形数组a , 对该数组的值进行置换
-		例如： a = [7, 9 , 30, 3]  ,   置换后为 [3, 30, 9,7]
-		如果     a = [7, 9, 30, 3, 4] , 置换后为 [4,3, 30 , 9,7]
+	 * 给定一个整形数组a , 对该数组的值进行置换 例如： a = {7, 9 , 30, 3} , 置换后为 {3, 30, 9,7} 如果 a =
+	 * {7, 9, 30, 3, 4} , 置换后为 {4,3, 30 , 9,7}
+	 * 
 	 * @param origin
 	 * @return
 	 */
-	public void reverseArray(int[] origin){
-		
+	public void reverseArray(int[] origin) {
+		int[] temp = new int[origin.length];
+		int index = 0;
+		for (int i = origin.length - 1; i >= 0; i--) {
+			temp[index++] = origin[i];
+		}
 	}
-	
+
 	/**
-	 * 现在有如下的一个数组：   int oldArr[]={1,3,4,5,0,0,6,6,0,5,4,7,6,7,0,5}   
-	 * 要求将以上数组中值为0的项去掉，将不为0的值存入一个新的数组，生成的新数组为：   
-	 * {1,3,4,5,6,6,5,4,7,6,7,5}  
+	 * 现在有如下的一个数组： int oldArr[]={1,3,4,5,0,0,6,6,0,5,4,7,6,7,0,5}
+	 * 要求将以上数组中值为0的项去掉，将不为0的值存入一个新的数组，生成的新数组为： {1,3,4,5,6,6,5,4,7,6,7,5}
+	 * 
 	 * @param oldArray
 	 * @return
 	 */
-	
-	public int[] removeZero(int[] oldArray){
-		return null;
+
+	public static int[] removeZero(int[] oldArray) {
+		int countZero = 0;
+		for (int i = 0; i < oldArray.length; i++) {
+			if(oldArray[i] == 0){
+				countZero++;
+			}
+		}
+		
+		int[] temp = new int[oldArray.length - countZero];
+		int index = 0;
+		for (int i = 0; i < oldArray.length; i++) {
+			if (oldArray[i] != 0) {
+				temp[index++] = oldArray[i];
+			}
+		}
+		return temp;
 	}
-	
+
 	/**
-	 * 给定两个已经排序好的整形数组， a1和a2 ,  创建一个新的数组a3, 使得a3 包含a1和a2 的所有元素， 并且仍然是有序的
-	 * 例如 a1 = [3, 5, 7,8]   a2 = [4, 5, 6,7]    则 a3 为[3,4,5,6,7,8]    , 注意： 已经消除了重复
+	 * 给定两个已经排序好的整形数组， a1和a2 , 创建一个新的数组a3, 使得a3 包含a1和a2 的所有元素， 并且仍然是有序的 例如 a1 =
+	 * {3, 5, 7,8} a2 = {4, 5, 6,7} 则 a3 为{3,4,5,6,7,8} , 注意： 已经消除了重复
+	 * 
 	 * @param array1
 	 * @param array2
 	 * @return
 	 */
-	
-	public int[] merge(int[] array1, int[] array2){
-		return  null;
+
+	public Integer[] merge(int[] array1, int[] array2) {
+        Integer[] temp = new Integer[array1.length + array2.length];
+        int i = 0,j = 0;
+        int index = 0;
+        
+        while(i < array1.length && j < array2.length){
+        	if(array1[i] <= array2[j]){
+        		temp[index++] = array1[i++];
+        	}else{
+        		temp[index++] = array2[j++];
+        	}
+        }
+        
+        while(i < array1.length){
+        	temp[index++] = array1[i++];
+        }
+        while(j < array2.length){
+        	temp[index++] = array2[j++];
+        }
+		return removeRepetition(temp);
 	}
+
 	/**
 	 * 把一个已经存满数据的数组 oldArray的容量进行扩展， 扩展后的新数据大小为oldArray.length + size
-	 * 注意，老数组的元素在新数组中需要保持
-	 * 例如 oldArray = [2,3,6] , size = 3,则返回的新数组为
-	 * [2,3,6,0,0,0]
+	 * 注意，老数组的元素在新数组中需要保持 例如 oldArray = {2,3,6} , size = 3,则返回的新数组为
+	 * {2,3,6,0,0,0}
+	 * 
 	 * @param oldArray
 	 * @param size
 	 * @return
 	 */
-	public int[] grow(int [] oldArray,  int size){
-		return null;
+	public static int[] grow(int[] oldArray, int size) {
+		int[] temp = new int[oldArray.length + size];
+		System.arraycopy(oldArray, 0, temp, 0, oldArray.length);
+		return temp;
 	}
-	
+
 	/**
-	 * 斐波那契数列为：1，1，2，3，5，8，13，21......  ，给定一个最大值， 返回小于该值的数列
-	 * 例如， max = 15 , 则返回的数组应该为 [1，1，2，3，5，8，13]
-	 * max = 1, 则返回空数组 []
+	 * 斐波那契数列为：1，1，2，3，5，8，13，21...... ，给定一个最大值， 返回小于该值的数列 例如， max = 15 ,
+	 * 则返回的数组应该为 [1，1，2，3，5，8，13] max = 1, 则返回空数组 []
+	 * 
 	 * @param max
 	 * @return
 	 */
-	public int[] fibonacci(int max){
-		return null;
+	public static int[] fibonacci(int max){
+		int[] temp = new int[max];
+		if(max == 1){
+			return null;
+		}
+		int index = 0;
+		for(int i = 0;i<max;i++){
+			if(fibonacciNum(i) < max){
+				temp[index++] = fibonacciNum(i);
+			}
+		}
+		return removeZero(temp);
+	}
+
+	public static int fibonacciNum(int n) {
+		if (n <= 1) {
+			return 1;
+		}
+		return fibonacciNum(n-1) + fibonacciNum(n-2);
 	}
 	
+
 	/**
-	 * 返回小于给定最大值max的所有素数数组
-	 * 例如max = 23, 返回的数组为[2,3,5,7,11,13,17,19]
+	 * 返回小于给定最大值max的所有素数数组 例如max = 23, 返回的数组为{2,3,5,7,11,13,17,19}
+	 * 
 	 * @param max
 	 * @return
 	 */
-	public int[] getPrimes(int max){
-		return null;
+	public static int[] getPrimes(int max){
+		boolean isPrime = false;
+		ArrayList<Integer> temp = new ArrayList<>();
+		for(int i=2; i < max; i++){
+		   isPrime = true;
+		   for (int j = 2; j < i; j++){
+		      if ((i % j) == 0) {
+		         isPrime = false;
+		         break;
+		      }
+		   }
+		   if(isPrime){
+			   temp.add(i);
+		   }
+		}
+		int[] array = new int[temp.size()];
+		int index = 0;
+		for(Integer te : temp){
+			array[index++] = te;
+		}
+		return array;
 	}
 	
 	/**
-	 * 所谓“完数”， 是指这个数恰好等于它的因子之和，例如6=1+2+3
-	 * 给定一个最大值max， 返回一个数组， 数组中是小于max 的所有完数
+	 * 所谓“完数”， 是指这个数恰好等于它的因子之和，例如6=1+2+3 给定一个最大值max， 返回一个数组， 数组中是小于max 的所有完数
+	 * 
 	 * @param max
 	 * @return
 	 */
-	public int[] getPerfectNumbers(int max){
-		return null;
+	public static Integer[] getPerfectNumbers(int max) {
+		Integer[] temp = new Integer[max];
+		int index = 0;
+		for (int i = 2; i < max; i++) {
+			int sum = 0;
+			for (int j = 1; j < i; j++) {
+				if (i % j == 0) {
+					sum += j;
+				}
+				if (sum == i){
+					temp[index++] = i;
+				}
+			}
+		}
+		return removeRepetition(temp);
 	}
 	
 	/**
-	 * 用seperator 把数组 array给连接起来
-	 * 例如array= [3,8,9], seperator = "-"
-	 * 则返回值为"3-8-9"
+	 * 用seperator 把数组 array给连接起来 例如array= {3,8,9}, seperator = "-" 则返回值为"3-8-9"
+	 * 
 	 * @param array
 	 * @param s
 	 * @return
 	 */
-	public String join(int[] array, String seperator){
-		return null;
+	public String join(int[] array, String seperator) {
+		String temp = "";
+		for(int i = 0;i < array.length -1; i++){
+			temp += array[i] + seperator;
+		}
+		temp += array[array.length-1];
+		return temp;
 	}
-	
 
+	public static Integer[] removeRepetition(Integer[] oldArray){
+		ArrayList<Integer> temp = new ArrayList<>();  
+		for(int i=0;i<oldArray.length;i++){  
+		    for(int j=i+1;j<oldArray.length;j++){  
+		        if(oldArray[i] == oldArray[j]){  
+		            j = ++i;  
+		        }  
+		    }  
+		    temp.add(oldArray[i]);  
+		}  
+		Integer[] result = (Integer[]) temp.toArray(new Integer[temp.size()]);  
+		return result;
+	}
+	
 }

From b20db2093256eba74587e984106cb274f3dc4f9e Mon Sep 17 00:00:00 2001
From: gaodekui <13526428940@163.com>
Date: Thu, 2 Mar 2017 16:29:14 +0800
Subject: [PATCH 24/36] =?UTF-8?q?=E6=8F=90=E4=BA=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 group16/1154151360/.classpath                 |   3 +
 .../src/com/list20170226/ArrayUtil.java       |  12 --
 .../src/com/litestruts/LoginAction.java       |  40 +++++
 .../1154151360/src/com/litestruts/Struts.java | 139 ++++++++++++++++++
 .../src/com/litestruts/StrutsTest.java        |  51 +++++++
 .../1154151360/src/com/litestruts/View.java   |  23 +++
 .../1154151360/src/com/litestruts/struts.xml  |  11 ++
 7 files changed, 267 insertions(+), 12 deletions(-)
 create mode 100644 group16/1154151360/src/com/litestruts/LoginAction.java
 create mode 100644 group16/1154151360/src/com/litestruts/Struts.java
 create mode 100644 group16/1154151360/src/com/litestruts/StrutsTest.java
 create mode 100644 group16/1154151360/src/com/litestruts/View.java
 create mode 100644 group16/1154151360/src/com/litestruts/struts.xml

diff --git a/group16/1154151360/.classpath b/group16/1154151360/.classpath
index fb5011632c..9746a6c933 100644
--- a/group16/1154151360/.classpath
+++ b/group16/1154151360/.classpath
@@ -2,5 +2,8 @@
 <classpath>
 	<classpathentry kind="src" path="src"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
+	<classpathentry kind="lib" path="src/dom4j-1.6.1.jar"/>
+	<classpathentry kind="lib" path="src/junit-3.8.1.jar"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>
diff --git a/group16/1154151360/src/com/list20170226/ArrayUtil.java b/group16/1154151360/src/com/list20170226/ArrayUtil.java
index a09c544787..685c02e767 100644
--- a/group16/1154151360/src/com/list20170226/ArrayUtil.java
+++ b/group16/1154151360/src/com/list20170226/ArrayUtil.java
@@ -261,16 +261,4 @@ public String join(int[] array, String seperator){
 		return array;
 	}
 //******************************************************************8
-public static void main(String[] args) {
-		
-		ArrayUtil util = new ArrayUtil();
-		int [] a1 = {3, 5, 7,8};
-		int [] a2 = {4, 5, 6,7};
-		int [] a3 = util.getPrimes(23);
-		
-		for(int c:a3){
-			System.out.print(c+" ");
-		}
-		
-	}
 }
diff --git a/group16/1154151360/src/com/litestruts/LoginAction.java b/group16/1154151360/src/com/litestruts/LoginAction.java
new file mode 100644
index 0000000000..24369135f9
--- /dev/null
+++ b/group16/1154151360/src/com/litestruts/LoginAction.java
@@ -0,0 +1,40 @@
+package com.litestruts;
+
+/**
+ * 这是一个用来展示登录的业务类， 其中的用户名和密码都是硬编码的。
+ * @author liuxin
+ *
+ */
+public class LoginAction {
+
+	 private String name ;
+	    private String password;
+	    private String message;
+
+	    public String getName() {
+	        return name;
+	    }
+
+	    public String getPassword() {
+	        return password;
+	    }
+
+	    public String execute(){
+	            if("test".equals(name) && "1234".equals(password)){
+	                this.message = "login successful";
+	                return "success";
+	            }
+	            this.message = "login failed,please check your user/pwd";
+	            return "fail";
+	    }
+
+	    public void setName(String name){
+	        this.name = name;
+	    }
+	    public void setPassword(String password){
+	        this.password = password;
+	    }
+	    public String getMessage(){
+	        return this.message;
+	    }
+}
diff --git a/group16/1154151360/src/com/litestruts/Struts.java b/group16/1154151360/src/com/litestruts/Struts.java
new file mode 100644
index 0000000000..49254d6a5f
--- /dev/null
+++ b/group16/1154151360/src/com/litestruts/Struts.java
@@ -0,0 +1,139 @@
+package com.litestruts;
+
+import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.dom4j.Attribute;
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.Element;
+import org.dom4j.io.SAXReader;
+
+
+
+public class Struts {
+
+    public static View runAction(String actionName, Map<String,String> parameters) throws DocumentException, ClassNotFoundException, InstantiationException, IllegalAccessException, NoSuchMethodException, SecurityException, IllegalArgumentException, InvocationTargetException {
+
+	/*
+
+		0. 读取配置文件struts.xml
+		
+		1. 根据actionName找到相对应的class ， 例如LoginAction,   通过反射实例化（创建对象）
+		据parameters中的数据，调用对象的setter方法， 例如parameters中的数据是 
+		("name"="test" ,  "password"="1234") ,     	
+		那就应该调用 setName和setPassword方法
+		
+		2. 通过反射调用对象的exectue 方法， 并获得返回值，例如"success"
+		
+		3. 通过反射找到对象的所有getter方法（例如 getMessage）,  
+		通过反射来调用， 把值和属性形成一个HashMap , 例如 {"message":  "登录成功"} ,  
+		放到View对象的parameters
+		
+		4. 根据struts.xml中的 <result> 配置,以及execute的返回值，  确定哪一个jsp，  
+		放到View对象的jsp字段中。
+	*/
+	
+	
+		//创建SAXreader对象
+		SAXReader reader = new SAXReader();
+		//将读取的文件封装成document对象
+		Document document = reader.read(new File("src/com/litestruts/struts.xml"));
+		//获取文档的根节点
+		Element root = document.getRootElement();
+		
+		List<Element> elist = listNode(root);
+		
+		Map <String,Map<String,String>> actionMap =  getAction(elist, actionName);
+		
+		for(Map.Entry<String, Map<String,String>> entity: actionMap.entrySet()){
+			 String className = entity.getKey();
+			 Class clazz = Class.forName(className);
+			 Method setName = clazz.getMethod("setName", String.class);
+			 Method setPassword = clazz.getMethod("setPassword", String.class);
+			 Method getMessage = clazz.getMethod("getMessage");
+			 Method execute = clazz.getMethod("execute");
+			 Object object = clazz.newInstance();
+			 setName.invoke(object, parameters.get("name"));
+			 setPassword.invoke(object, parameters.get("password"));
+			 String status = (String) execute.invoke(object);
+			 String message = (String) getMessage.invoke(object);
+			 
+			 String jsp = entity.getValue().get(status);
+			 
+			 Map<String,String> parameter = new HashMap<String, String>();
+			 
+			 parameter.put("message", message);
+			 
+			 View view = new View();
+			 
+			 view.setJsp(jsp);
+			 view.setParameters(parameter);
+			 
+			 return view;
+		 }
+		 
+		return null;
+	}  
+	
+	//获取节点的所有子节点
+	private static List<Element> listNode(Element node){
+		
+			Iterator<Element> iterator = node.elementIterator();
+			List<Element> elist = new ArrayList<Element>();
+			while (iterator.hasNext()){
+				Element e = iterator.next();
+				elist.add(e);
+			}
+		if (elist.isEmpty())
+			return null;
+		else
+			return elist;
+	}
+	
+	//获取对应的Action信息
+	private static  Map <String,Map<String,String>>  getAction(List<Element> elist,String actionName){
+		
+		for (Element node:elist){
+			List<Attribute> attributes = node.attributes();
+			if (attributes.isEmpty())
+				getAction(listNode(node),actionName);
+			else{
+				Attribute attribute = node.attribute("name");
+				if (attribute.getValue().equals(actionName)){
+					String className = node.attribute("class").getValue();
+					List<Element> childElements = listNode(node);
+					Map<String,String> resMap =install(childElements);
+					Map <String,Map<String,String>> actionMap = new HashMap<String, Map<String,String>>();
+					actionMap.put(className, resMap);
+					return actionMap;
+				}
+			}
+		}
+		return null;
+	}
+	
+	//组装action的result
+	private static Map<String,String> install(List<Element> elements){
+		Map<String,String> resultMap = new HashMap<String, String>();
+		for (Element node: elements){
+			Attribute attribute  = node.attribute("name");
+			String value;
+			if (node.getTextTrim().isEmpty())
+				value = "";
+			else
+				value = node.getTextTrim();
+			
+			resultMap.put(attribute.getValue(), value);
+			
+		}
+		return resultMap;
+	}
+
+}
diff --git a/group16/1154151360/src/com/litestruts/StrutsTest.java b/group16/1154151360/src/com/litestruts/StrutsTest.java
new file mode 100644
index 0000000000..9317cc5e26
--- /dev/null
+++ b/group16/1154151360/src/com/litestruts/StrutsTest.java
@@ -0,0 +1,51 @@
+package com.litestruts;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.Assert;
+
+import org.dom4j.Attribute;
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.Element;
+import org.dom4j.io.SAXReader;
+import org.junit.Test;
+
+public class StrutsTest {
+
+	@Test
+	public void testLoginActionSuccess() throws DocumentException, ClassNotFoundException, InstantiationException, IllegalAccessException, NoSuchMethodException, SecurityException, IllegalArgumentException, InvocationTargetException {
+		
+		String actionName = "login";
+		
+		Map<String,String> params = new HashMap<String,String>();
+		params.put("name","test");
+		params.put("password","1234");
+	
+		View view  = Struts.runAction(actionName,params);        
+		
+		Assert.assertEquals("/jsp/homepage.jsp", view.getJsp());
+		Assert.assertEquals("login successful", view.getParameters().get("message"));
+	}
+
+	@Test
+	public void testLoginActionFailed() throws DocumentException, ClassNotFoundException, InstantiationException, IllegalAccessException, NoSuchMethodException, SecurityException, IllegalArgumentException, InvocationTargetException {
+		String actionName = "login";
+		Map<String,String> params = new HashMap<String,String>();
+		params.put("name","test");
+		params.put("password","123456"); //密码和预设的不一致
+		
+		View view  = Struts.runAction(actionName,params);        
+		
+		Assert.assertEquals("/jsp/showLogin.jsp", view.getJsp());
+		Assert.assertEquals("login failed,please check your user/pwd", view.getParameters().get("message"));
+	}
+
+}
diff --git a/group16/1154151360/src/com/litestruts/View.java b/group16/1154151360/src/com/litestruts/View.java
new file mode 100644
index 0000000000..af63dce301
--- /dev/null
+++ b/group16/1154151360/src/com/litestruts/View.java
@@ -0,0 +1,23 @@
+package com.litestruts;
+
+import java.util.Map;
+
+public class View {
+	private String jsp;
+	private Map parameters;
+	
+	public String getJsp() {
+		return jsp;
+	}
+	public View setJsp(String jsp) {
+		this.jsp = jsp;
+		return this;
+	}
+	public Map getParameters() {
+		return parameters;
+	}
+	public View setParameters(Map parameters) {
+		this.parameters = parameters;
+		return this;
+	}
+}
diff --git a/group16/1154151360/src/com/litestruts/struts.xml b/group16/1154151360/src/com/litestruts/struts.xml
new file mode 100644
index 0000000000..ddbcbc38da
--- /dev/null
+++ b/group16/1154151360/src/com/litestruts/struts.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<struts>
+    <action name="login" class="com.litestruts.LoginAction">
+        <result name="success">/jsp/homepage.jsp</result>
+        <result name="fail">/jsp/showLogin.jsp</result>
+    </action>
+    <action name="logout" class="com.litestruts.LogoutAction">
+    	<result name= "success">/jsp/welcome.jsp</result>
+    	<result name= "error">/jsp/error.jsp</result>
+    </action>
+</struts>
\ No newline at end of file

From 1223321f270d2070bdf29dae9b99f7de2a3d0c5d Mon Sep 17 00:00:00 2001
From: gaodekui <13526428940@163.com>
Date: Thu, 2 Mar 2017 16:31:26 +0800
Subject: [PATCH 25/36] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E7=9B=AE=E5=BD=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../1154151360/src/com/{list20170226 => array}/ArrayUtil.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
 rename group16/1154151360/src/com/{list20170226 => array}/ArrayUtil.java (99%)

diff --git a/group16/1154151360/src/com/list20170226/ArrayUtil.java b/group16/1154151360/src/com/array/ArrayUtil.java
similarity index 99%
rename from group16/1154151360/src/com/list20170226/ArrayUtil.java
rename to group16/1154151360/src/com/array/ArrayUtil.java
index 685c02e767..8ddc93d495 100644
--- a/group16/1154151360/src/com/list20170226/ArrayUtil.java
+++ b/group16/1154151360/src/com/array/ArrayUtil.java
@@ -1,4 +1,4 @@
-package com.list20170226;
+package com.array;
 
 import java.util.ArrayList;
 import java.util.HashMap;

From a0742f1dd2f6b72cb2812f463ef2f7c30cc6c8a9 Mon Sep 17 00:00:00 2001
From: Administrator <Administrator@MS-20160123SNDH>
Date: Thu, 2 Mar 2017 21:28:48 +0800
Subject: [PATCH 26/36] 63912401

---
 group16/63912401/.classpath                   |   5 +-
 .../com/coderising/action/LoginAction.java    |  45 +++
 .../src/com/coderising/array/ArrayUtil.java   | 270 ++++++++++++++++++
 .../coderising/litestruts/ActionMapping.java  |  68 +++++
 .../litestruts/ConfigurationManager.java      |  83 ++++++
 .../coderising/litestruts/DefaultAction.java  | 121 ++++++++
 .../coderising/litestruts/ResultMapping.java  |  48 ++++
 .../src/com/coderising/litestruts/Struts.java |  37 +++
 .../com/coderising/litestruts/StrutsTest.java |  39 +++
 .../src/com/coderising/litestruts/View.java   |  23 ++
 .../src/com/coderising/litestruts/struts.xml  |  11 +
 11 files changed, 749 insertions(+), 1 deletion(-)
 create mode 100644 group16/63912401/src/com/coderising/action/LoginAction.java
 create mode 100644 group16/63912401/src/com/coderising/array/ArrayUtil.java
 create mode 100644 group16/63912401/src/com/coderising/litestruts/ActionMapping.java
 create mode 100644 group16/63912401/src/com/coderising/litestruts/ConfigurationManager.java
 create mode 100644 group16/63912401/src/com/coderising/litestruts/DefaultAction.java
 create mode 100644 group16/63912401/src/com/coderising/litestruts/ResultMapping.java
 create mode 100644 group16/63912401/src/com/coderising/litestruts/Struts.java
 create mode 100644 group16/63912401/src/com/coderising/litestruts/StrutsTest.java
 create mode 100644 group16/63912401/src/com/coderising/litestruts/View.java
 create mode 100644 group16/63912401/src/com/coderising/litestruts/struts.xml

diff --git a/group16/63912401/.classpath b/group16/63912401/.classpath
index d171cd4c12..74368f11c3 100644
--- a/group16/63912401/.classpath
+++ b/group16/63912401/.classpath
@@ -1,6 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
 	<classpathentry kind="src" path="src"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.7.0_67"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
+	<classpathentry kind="lib" path="lib/dom4j-1.6.1.jar"/>
+	<classpathentry kind="lib" path="lib/commons-lang3-3.1.jar"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>
diff --git a/group16/63912401/src/com/coderising/action/LoginAction.java b/group16/63912401/src/com/coderising/action/LoginAction.java
new file mode 100644
index 0000000000..64d4d355b6
--- /dev/null
+++ b/group16/63912401/src/com/coderising/action/LoginAction.java
@@ -0,0 +1,45 @@
+package com.coderising.action;
+
+/**
+ * 这是一个用来展示登录的业务类， 其中的用户名和密码都是硬编码的。
+ * @author liuxin
+ *
+ */
+public class LoginAction{
+    private String name ;
+    private String password;
+    private String message;
+
+    public String execute(){
+            if("test".equals(name) && "1234".equals(password)){
+                this.message = "login successful";
+                return "success";
+            }
+            this.message = "login failed,please check your user/pwd";
+            return "fail";
+    }
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getPassword() {
+		return password;
+	}
+
+	public void setPassword(String password) {
+		this.password = password;
+	}
+
+	public String getMessage() {
+		return message;
+	}
+
+	public void setMessage(String message) {
+		this.message = message;
+	}
+}
diff --git a/group16/63912401/src/com/coderising/array/ArrayUtil.java b/group16/63912401/src/com/coderising/array/ArrayUtil.java
new file mode 100644
index 0000000000..c8510b08e1
--- /dev/null
+++ b/group16/63912401/src/com/coderising/array/ArrayUtil.java
@@ -0,0 +1,270 @@
+package com.coderising.array;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+
+/**
+ * ArrayUtil
+ * @author greenhills
+ * 2017年2月28日 下午10:49:41
+ */
+public class ArrayUtil {
+	
+	public static void main(String[] args) {
+//		int[] array1={5,8,9,0,-4};
+//		int[] array2={4,5,6,7,8,9};
+//		int[] array3=ArrayUtil.merge(array1, array2);
+//		for(Integer t:array3){
+//			System.out.print(t +"\t");
+//		}
+		
+//		int[] array3={4,5,6,7,8,9};
+//		array3 = ArrayUtil.grow(array3,5);
+//		for(int t:array3){
+//			System.out.print(t +"\t");
+//		}
+		
+//		int[] array4=ArrayUtil.fibonacci(100);
+//		for(Integer t:array4){
+//			System.out.print(t +"\t");
+//		}
+		
+//		int[] array5=ArrayUtil.getPrimes(2);
+//		for(Integer t:array5){
+//			System.out.print(t +"\t");
+//		}
+		
+		int[] array6=ArrayUtil.getPerfectNumbers(2000);
+		for(Integer t:array6){
+			System.out.print(t +"\t");
+		}
+			
+	}
+	
+	/**
+	 * 给定一个整形数组a , 对该数组的值进行置换
+		例如： a = [7, 9 , 30, 3]  ,   置换后为 [3, 30, 9,7]
+		如果     a = [7, 9, 30, 3, 4] , 置换后为 [4,3, 30 , 9,7]
+	 * @param origin
+	 * @return
+	 */
+	public static void reverseArray(int[] origin){
+		for (int i = 0; i < origin.length>>1; i++) {
+			origin[i]^=origin[origin.length - 1 - i]^(origin[origin.length - 1 - i]=origin[i]);
+		}
+		
+		//方法2 可以使用Collections.reverse(list)方法，但是int 和 Integer数组之间转化消耗性能
+		//Collections.reverse(list);
+	}
+	
+	/**
+	 * 现在有如下的一个数组：   Integer oldArr[]={1,3,4,5,0,0,6,6,0,5,4,7,6,7,0,5}   
+	 * 要求将以上数组中值为0的项去掉，将不为0的值存入一个新的数组，生成的新数组为：   
+	 * {1,3,4,5,6,6,5,4,7,6,7,5}  
+	 * @param oldArray
+	 * @return
+	 */
+	
+	public int[] removeZero(int[] oldArray){
+		List<Integer> list=new ArrayList<Integer>();
+		for(Integer data:oldArray){
+			if(data != 0){
+				list.add(data);
+			}
+		}
+		int[] newArray=new int[list.size()];
+		for(Integer i=0;i<list.size();i++){
+			newArray[i] = list.get(i);
+		}
+		
+		//newArray = list.toArray(newArray); //Integer类型可用此方法
+		return newArray;
+	}
+	
+	/**
+	 * 给定两个已经排序好的整形数组， a1和a2 ,  创建一个新的数组a3, 使得a3 包含a1和a2 的所有元素， 并且仍然是有序的
+	 * 例如 a1 = [3, 5, 7,8]   a2 = [4, 5, 6,7]    则 a3 为[3,4,5,6,7,8]    , 注意： 已经消除了重复
+	 * @param array1
+	 * @param array2
+	 * @return
+	 */
+	
+	public static int[] merge(int[] array1, int[] array2){
+		Set<Integer> set=new HashSet<Integer>();
+		for(Integer t:array1){
+			set.add(t);
+		}
+		for(Integer t:array2){
+			set.add(t);
+		}
+		List<Integer> list=new ArrayList<Integer>(set);
+		java.util.Collections.sort(list);
+		int[] result =new int[list.size()];
+		for(int i=0;i<list.size();i++){
+			result[i] = list.get(i);
+		}
+		return  result;
+	}
+	
+	/**
+	 * 把一个已经存满数据的数组 oldArray的容量进行扩展， 扩展后的新数据大小为oldArray.length + size
+	 * 注意，老数组的元素在新数组中需要保持
+	 * 例如 oldArray = [2,3,6] , size = 3,则返回的新数组为
+	 * [2,3,6,0,0,0]
+	 * @param oldArray
+	 * @param size
+	 * @return
+	 */
+	public static int[] grow(int [] oldArray,  int size){
+		int len = oldArray.length;
+		return Arrays.copyOf(oldArray, len + size);
+	}
+	
+	/**
+	 * 斐波那契数列为：1，1，2，3，5，8，13，21......  ，给定一个最大值， 返回小于该值的数列
+	 * 例如， max = 15 , 则返回的数组应该为 [1，1，2，3，5，8，13]
+	 * max = 1, 则返回空数组 []
+	 * @param max
+	 * @return
+	 */
+	public static int[] fibonacci(int max){
+		int [] result=new int[0];
+		if(max > 1){
+			List<Integer> list=new ArrayList<Integer>();
+			list.add(1);
+			list.add(1);
+			int i=0;
+			int temp=list.get(i)+list.get(i+1);
+			while(temp < max){
+				list.add(temp);
+				i++;
+				temp=list.get(i)+list.get(i+1);
+			}
+			
+			result=new int[list.size()];
+			
+			i=0;
+			for(int d:list){
+				result[i]=d;
+				i++;
+			}
+		}
+		
+		return result;
+	}
+	
+	/**
+	 * 返回小于给定最大值max的所有素数数组
+	 * 例如max = 23, 返回的数组为[2,3,5,7,11,13,17,19]
+	 * @param max
+	 * @return
+	 */
+	public static int[] getPrimes(int max){
+		List<Integer> list=new ArrayList<Integer>();
+		for(int i=2;i<max;i++){
+			if(ArrayUtil.isPrimes(i)){
+				list.add(i);
+			}
+		}
+		
+		int[] result=new int[list.size()];
+		
+		int i=0;
+		for(int d:list){
+			result[i]=d;
+			i++;
+		}
+		return result;
+	}
+	
+	/**
+	 * 判断一个数是否为素数
+	 * 
+	 * @param d
+	 * @return  true是素数，false不是素数
+	 */
+	public static boolean isPrimes(int d){
+		if(d<=1) return false;
+		if(d==2) return true;
+		
+		int base=(int) Math.sqrt(d);
+		for(int i=2;i<=base;i++){
+			if(d%i==0){
+				return false;
+			}
+		}
+		return true;
+	}
+	
+	
+	/**
+	 * 所谓“完数”， 是指这个数恰好等于它的因子之和，例如6=1+2+3
+	 * 给定一个最大值max， 返回一个数组， 数组中是小于max 的所有完数
+	 * @param max
+	 * @return
+	 */
+	public static int[] getPerfectNumbers(int max){
+		List<Integer> list=new ArrayList<Integer>();
+		for(int i=1;i<max;i++){
+			if(ArrayUtil.isPerfectNumber(i)){
+				list.add(i);
+			}
+		}
+		
+		int[] result=new int[list.size()];
+		
+		int i=0;
+		for(int d:list){
+			result[i]=d;
+			i++;
+		}
+		return result;
+	}
+	
+	/**
+	 * 判断一个数是否为完数(这个数等于它的所有因子之和)
+	 * 
+	 * @param d
+	 * @return true是完数，false不是完数
+	 * @author greenhills
+	 * 2017年2月28日 下午10:18:29
+	 */
+	public static boolean isPerfectNumber(int d){
+		int sum=0;
+		for(int i=1;i<d;i++){
+			if(d%i==0){
+				sum+=i;
+			}
+		}
+		if(d==sum) return true;
+		
+		return false;
+	}
+	
+	/**
+	 * 用seperator 把数组 array给连接起来
+	 * 例如array= [3,8,9], seperator = "-"
+	 * 则返回值为"3-8-9"
+	 * @param array
+	 * @param s
+	 * @return
+	 */
+	public static String join(Integer[] array, String seperator){
+		StringBuffer sb=new StringBuffer();
+		for(Integer i:array){
+			sb.append(i+seperator);
+		}
+		String result=null;
+		//去除末尾的seperator
+		if(sb.lastIndexOf(seperator) == sb.length()-seperator.length()){
+			result = sb.substring(0, sb.length()-seperator.length());
+		}else{
+			result = sb.toString();
+		}
+		return result;
+	}
+}
diff --git a/group16/63912401/src/com/coderising/litestruts/ActionMapping.java b/group16/63912401/src/com/coderising/litestruts/ActionMapping.java
new file mode 100644
index 0000000000..4d7d78abb0
--- /dev/null
+++ b/group16/63912401/src/com/coderising/litestruts/ActionMapping.java
@@ -0,0 +1,68 @@
+package com.coderising.litestruts;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+
+/** 
+ * @author greenhills
+ * @version 创建时间：2017年2月27日 下午10:36:35 
+ * 
+ */
+public class ActionMapping {
+	/**
+	 * action名称
+	 */
+	private String name;
+	/**
+	 * 执行action的类
+	 */
+	private String className;
+	/**
+	 * 执行action的类方法
+	 */
+	private String method;
+	/**
+	 * 保存ResultMapping结果，以result标签的name作为key
+	 */
+	private Map<String,ResultMapping> resultMappings=new HashMap<String,ResultMapping>();
+	
+	public ActionMapping() {}
+
+	public ActionMapping(String name, String className, String method) {
+		this.name = name;
+		this.className = className;
+		this.method = StringUtils.isBlank(method) ? "execute" : method; //未配置时，默认查找execute方法执行
+	}
+	
+	public String getName() {
+		return name;
+	}
+	public void setName(String name) {
+		this.name = name;
+	}
+	public String getClassName() {
+		return className;
+	}
+	public void setClassName(String className) {
+		this.className = className;
+	}
+	public String getMethod() {
+		return method;
+	}
+	public void setMethod(String method) {
+		this.method = method;
+	}
+	public Map<String, ResultMapping> getResultMappings() {
+		return resultMappings;
+	}
+	public void setResultMappings(Map<String, ResultMapping> resultMappings) {
+		this.resultMappings = resultMappings;
+	}
+	
+	//扩展的方法，用于保存
+	public void setResultMappings(String key, ResultMapping value) {
+		this.resultMappings.put(key, value);
+	}
+}
diff --git a/group16/63912401/src/com/coderising/litestruts/ConfigurationManager.java b/group16/63912401/src/com/coderising/litestruts/ConfigurationManager.java
new file mode 100644
index 0000000000..55204d1b38
--- /dev/null
+++ b/group16/63912401/src/com/coderising/litestruts/ConfigurationManager.java
@@ -0,0 +1,83 @@
+package com.coderising.litestruts;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.Element;
+import org.dom4j.io.SAXReader;
+
+/**
+ * 解析XML文件
+ * ConfigurationManager
+ * @author greenhills
+ * 2017年2月27日 下午10:18:10
+ */
+public class ConfigurationManager {
+	/**
+	 * 读取xml文件的文档对象
+	 */
+	private static Document document;
+	/**
+	 * 配置文件路径
+	 */
+	static  String configureFileName="struts.xml";
+	/**
+	 * 当前类路径
+	 */
+	static  String currentPath;	
+	static{
+		currentPath = ConfigurationManager.class.getResource("").getPath().substring(1);
+	}
+	
+	static{
+		try {
+			SAXReader sax=new SAXReader();
+			document = sax.read(new File(currentPath+configureFileName));
+		} catch (DocumentException e) {
+			e.printStackTrace();
+		}
+	}
+	
+	/**
+	 * 解析配置文件
+	 * ConfigurationManager.java
+	 * @param @return
+	 * @author greenhills
+	 * 2017年2月27日 下午11:28:59
+	 */
+	public static Map<String,ActionMapping> loadXml(){
+		Map<String,ActionMapping> actionMappings=new HashMap<String, ActionMapping>();
+		
+		Element root=document.getRootElement();
+		List<Element> actionList= root.elements("action");
+		
+		for(Element actionElemnt:actionList){
+			ActionMapping actionMapping=new ActionMapping(
+					actionElemnt.attributeValue("name"),
+					actionElemnt.attributeValue("class"),
+					actionElemnt.attributeValue("method")
+				);
+			//获取action下的result节点
+			List<Element> resultList = actionElemnt.elements("result");
+			for(Element resultElemnt:resultList){
+				ResultMapping resultMapping=new ResultMapping(
+						resultElemnt.attributeValue("name"), 
+						resultElemnt.attributeValue("type"), 
+						resultElemnt.getTextTrim()
+					);
+				
+				//保存ResultMapping（以result标签的name为key）
+				actionMapping.setResultMappings(resultMapping.getName(),resultMapping);
+			}
+			
+			//保存ActionMapping（以action标签的name为key）
+			actionMappings.put(actionMapping.getName(), actionMapping);
+		}
+		
+		return actionMappings;
+	}
+}
diff --git a/group16/63912401/src/com/coderising/litestruts/DefaultAction.java b/group16/63912401/src/com/coderising/litestruts/DefaultAction.java
new file mode 100644
index 0000000000..c654a11a02
--- /dev/null
+++ b/group16/63912401/src/com/coderising/litestruts/DefaultAction.java
@@ -0,0 +1,121 @@
+package com.coderising.litestruts;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+/** 
+ * @author greenhills
+ * @version 创建时间：2017年2月27日 下午11:48:56 
+ * 
+ */
+public class DefaultAction {
+	private ActionMapping actionMapping;
+	private  Object targetAction;   //由DefaultAction反射调用的目标对象
+	
+	//构造方法，实例化对象
+	public DefaultAction(ActionMapping actionMapping) {
+		this.actionMapping = actionMapping;
+		//实例化对象
+		try {
+			this.targetAction = Class.forName(this.actionMapping.getClassName()).newInstance();
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+	
+	/**
+	 * 初始化参数
+	 * DefaultAction.java
+	 * @param 
+	 * @author greenhills
+	 * 2017年2月27日 下午11:58:05
+	 */
+	public void initParam(Map<String,String> parameters){
+		Class clazz=this.targetAction.getClass();
+		Set<String> keys=parameters.keySet();
+		try {
+			for(String key:keys){
+				String _key = getFirstUpper(key);
+				//调用set方法赋值
+				Method method=clazz.getDeclaredMethod("set"+_key,clazz.getDeclaredField(key).getType());
+				method.invoke(this.targetAction, parameters.get(key));
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+	
+	/**
+	 * 调用实例方法
+	 * DefaultAction.java
+	 * @param @return
+	 * @author greenhills
+	 * 2017年2月27日 下午11:53:56
+	 */
+	public String runMethod(){
+		String methodName=this.actionMapping.getMethod();
+		Class clazz=this.targetAction.getClass();
+		String result="success";
+		//调用set方法赋值
+		try {
+			Method method=clazz.getDeclaredMethod(methodName);
+			result = (String) method.invoke(this.targetAction);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return result;
+	}
+	/**
+	 * 获取action字段的值
+	 * DefaultAction.java
+	 * @param @param fields
+	 * @param @return
+	 * @author greenhills
+	 * 2017年2月28日 上午12:39:01
+	 */
+	public Map<String,Object> getFieldValue(String[] fields){
+		Map<String,Object> result=new HashMap<String, Object>();
+		try {
+			Class clazz=this.targetAction.getClass();
+			for(String field:fields){
+				String _field = getFirstUpper(field);
+				//调用get方法获取值
+				Method method=clazz.getDeclaredMethod("get"+_field);
+				result.put(field,method.invoke(this.targetAction));
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return result;
+	}
+	
+	
+	/**
+	 * 将首字母改为大写
+	 * DefaultAction.java
+	 * @param @param val
+	 * @param @return
+	 * @author greenhills
+	 * 2017年2月28日 上午12:24:34
+	 */
+	private String getFirstUpper(String val){
+		return val.substring(0, 1).toUpperCase()+val.substring(1);
+	}
+	
+	
+	public ActionMapping getActionMapping() {
+		return actionMapping;
+	}
+	public void setActionMapping(ActionMapping actionMapping) {
+		this.actionMapping = actionMapping;
+	}
+	public Object getTargetAction() {
+		return targetAction;
+	}
+	public void setTargetAction(Object targetAction) {
+		this.targetAction = targetAction;
+	}
+}
diff --git a/group16/63912401/src/com/coderising/litestruts/ResultMapping.java b/group16/63912401/src/com/coderising/litestruts/ResultMapping.java
new file mode 100644
index 0000000000..9a2650db09
--- /dev/null
+++ b/group16/63912401/src/com/coderising/litestruts/ResultMapping.java
@@ -0,0 +1,48 @@
+package com.coderising.litestruts;
+
+import org.apache.commons.lang3.StringUtils;
+
+/** 
+ * @author greenhills
+ * @version 创建时间：2017年2月27日 下午10:39:20 
+ * 
+ */
+public class ResultMapping {
+	/**
+	 * 映射结构：<result name="success" type="redirect">/jsp/homepage.jsp</result>
+	 */
+	private String name;
+	private String type;
+	private String urlPath;
+	
+	public ResultMapping() {
+		super();
+	}
+	
+	public ResultMapping(String name, String type, String urlPath) {
+		super();
+		this.name = StringUtils.isBlank(name) ? "success" : name; //默认成功
+		this.type = StringUtils.isBlank(type) ? "dispatcher" : type; //默认转发
+		this.urlPath = urlPath;
+	}
+	
+	
+	public String getName() {
+		return name;
+	}
+	public void setName(String name) {
+		this.name = name;
+	}
+	public String getType() {
+		return type;
+	}
+	public void setType(String type) {
+		this.type = type;
+	}
+	public String getUrlPath() {
+		return urlPath;
+	}
+	public void setUrlPath(String urlPath) {
+		this.urlPath = urlPath;
+	}
+}
diff --git a/group16/63912401/src/com/coderising/litestruts/Struts.java b/group16/63912401/src/com/coderising/litestruts/Struts.java
new file mode 100644
index 0000000000..06a23bb864
--- /dev/null
+++ b/group16/63912401/src/com/coderising/litestruts/Struts.java
@@ -0,0 +1,37 @@
+package com.coderising.litestruts;
+
+import java.util.Map;
+
+
+public class Struts {
+
+    public static View runAction(String actionName, Map<String,String> parameters) {
+//		0. 读取配置文件struts.xml
+    	Map<String,ActionMapping> actionMappings = ConfigurationManager.loadXml();
+    	
+// 		1. 根据actionName找到相对应的class ， 例如LoginAction,   通过反射实例化（创建对象）
+//		据parameters中的数据，调用对象的setter方法， 例如parameters中的数据是 
+//		("name"="test" ,  "password"="1234") ,     	
+//		那就应该调用 setName和setPassword方法
+    	ActionMapping actionMapping = actionMappings.get(actionName);
+    	DefaultAction action=new DefaultAction(actionMapping);
+    	action.initParam(parameters);
+    	
+//		2. 通过反射调用对象的exectue 方法， 并获得返回值，例如"success"
+		String result= action.runMethod();
+		
+//		3. 通过反射找到对象的所有getter方法（例如 getMessage）,  
+//		通过反射来调用， 把值和属性形成一个HashMap , 例如 {"message":  "登录成功"} ,  
+//		放到View对象的parameters
+		
+		Map<String,Object> messageMaps=action.getFieldValue(new String[]{"message"});
+		
+//		4. 根据struts.xml中的 <result> 配置,以及execute的返回值，  确定哪一个jsp，  
+//		放到View对象的jsp字段中。
+        View view =new View();
+        view.setJsp(actionMapping.getResultMappings().get(result).getUrlPath());
+        view.setParameters(messageMaps);
+    	return view;
+    }    
+
+}
diff --git a/group16/63912401/src/com/coderising/litestruts/StrutsTest.java b/group16/63912401/src/com/coderising/litestruts/StrutsTest.java
new file mode 100644
index 0000000000..4061019b2e
--- /dev/null
+++ b/group16/63912401/src/com/coderising/litestruts/StrutsTest.java
@@ -0,0 +1,39 @@
+package com.coderising.litestruts;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class StrutsTest {
+
+	@Test
+	public void testLoginActionSuccess() {
+		
+		String actionName = "login";
+        
+		Map<String,String> params = new HashMap<String,String>();
+        params.put("name","test");
+        params.put("password","1234");
+        
+        
+        View view  = Struts.runAction(actionName,params);        
+        
+        Assert.assertEquals("/jsp/homepage.jsp", view.getJsp());
+        Assert.assertEquals("login successful", view.getParameters().get("message"));
+	}
+
+	@Test
+	public void testLoginActionFailed() {
+		String actionName = "login";
+		Map<String,String> params = new HashMap<String,String>();
+        params.put("name","test");
+        params.put("password","123456"); //密码和预设的不一致
+        
+        View view  = Struts.runAction(actionName,params);        
+        
+        Assert.assertEquals("/jsp/showLogin.jsp", view.getJsp());
+        Assert.assertEquals("login failed,please check your user/pwd", view.getParameters().get("message"));
+	}
+}
diff --git a/group16/63912401/src/com/coderising/litestruts/View.java b/group16/63912401/src/com/coderising/litestruts/View.java
new file mode 100644
index 0000000000..0194c681f6
--- /dev/null
+++ b/group16/63912401/src/com/coderising/litestruts/View.java
@@ -0,0 +1,23 @@
+package com.coderising.litestruts;
+
+import java.util.Map;
+
+public class View {
+	private String jsp;
+	private Map parameters;
+	
+	public String getJsp() {
+		return jsp;
+	}
+	public View setJsp(String jsp) {
+		this.jsp = jsp;
+		return this;
+	}
+	public Map getParameters() {
+		return parameters;
+	}
+	public View setParameters(Map parameters) {
+		this.parameters = parameters;
+		return this;
+	}
+}
diff --git a/group16/63912401/src/com/coderising/litestruts/struts.xml b/group16/63912401/src/com/coderising/litestruts/struts.xml
new file mode 100644
index 0000000000..76cc617a8a
--- /dev/null
+++ b/group16/63912401/src/com/coderising/litestruts/struts.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<struts>
+    <action name="login" class="com.coderising.action.LoginAction" method="execute">
+        <result name="success">/jsp/homepage.jsp</result>
+        <result name="fail">/jsp/showLogin.jsp</result>
+    </action>
+    <action name="logout" class="com.coderising.action.LogoutAction" method="execute">
+    	<result name="success">/jsp/welcome.jsp</result>
+    	<result name="error">/jsp/error.jsp</result>
+    </action>
+</struts>
\ No newline at end of file

From 59924cc6cfff3eff50beafad0f5128007cc32e0d Mon Sep 17 00:00:00 2001
From: xiaoyuan <joy32812@qq.com>
Date: Thu, 2 Mar 2017 21:37:42 +0800
Subject: [PATCH 27/36] lite structs and array manipulation

---
 .../com/coderising/litestruts/struts.xml      |  11 +
 .../coding/coderising/litestruts/struts.xml   |  11 +
 .../{com => net}/coding/basic/ArrayList.java  |   2 +-
 .../coding/basic/BinaryTreeNode.java          |   2 +-
 .../{com => net}/coding/basic/Iterator.java   |   2 +-
 .../{com => net}/coding/basic/LinkedList.java |   2 +-
 .../src/{com => net}/coding/basic/List.java   |   2 +-
 .../src/{com => net}/coding/basic/Queue.java  |   2 +-
 .../src/{com => net}/coding/basic/Stack.java  |   2 +-
 .../src/{com => net}/coding/basic/Test.java   |   2 +-
 .../coding/coderising/array/ArrayUtil.java    | 203 ++++++++++++++++++
 .../coderising/array/ArrayUtilTest.java       |  76 +++++++
 .../coderising/litestruts/LoginAction.java    |  39 ++++
 .../coderising/litestruts/LogoutAction.java   |  36 ++++
 .../coding/coderising/litestruts/Struts.java  | 126 +++++++++++
 .../coderising/litestruts/StrutsTest.java     |  70 ++++++
 .../coding/coderising/litestruts/View.java    |  23 ++
 .../coding/coderising/litestruts/struts.xml   |  11 +
 18 files changed, 614 insertions(+), 8 deletions(-)
 create mode 100644 group16/542087872/out/production/coding2017/com/coderising/litestruts/struts.xml
 create mode 100644 group16/542087872/out/production/coding2017/net/coding/coderising/litestruts/struts.xml
 rename group16/542087872/src/{com => net}/coding/basic/ArrayList.java (98%)
 rename group16/542087872/src/{com => net}/coding/basic/BinaryTreeNode.java (97%)
 rename group16/542087872/src/{com => net}/coding/basic/Iterator.java (75%)
 rename group16/542087872/src/{com => net}/coding/basic/LinkedList.java (99%)
 rename group16/542087872/src/{com => net}/coding/basic/List.java (87%)
 rename group16/542087872/src/{com => net}/coding/basic/Queue.java (92%)
 rename group16/542087872/src/{com => net}/coding/basic/Stack.java (94%)
 rename group16/542087872/src/{com => net}/coding/basic/Test.java (99%)
 create mode 100644 group16/542087872/src/net/coding/coderising/array/ArrayUtil.java
 create mode 100644 group16/542087872/src/net/coding/coderising/array/ArrayUtilTest.java
 create mode 100644 group16/542087872/src/net/coding/coderising/litestruts/LoginAction.java
 create mode 100644 group16/542087872/src/net/coding/coderising/litestruts/LogoutAction.java
 create mode 100644 group16/542087872/src/net/coding/coderising/litestruts/Struts.java
 create mode 100644 group16/542087872/src/net/coding/coderising/litestruts/StrutsTest.java
 create mode 100644 group16/542087872/src/net/coding/coderising/litestruts/View.java
 create mode 100644 group16/542087872/src/net/coding/coderising/litestruts/struts.xml

diff --git a/group16/542087872/out/production/coding2017/com/coderising/litestruts/struts.xml b/group16/542087872/out/production/coding2017/com/coderising/litestruts/struts.xml
new file mode 100644
index 0000000000..99063bcb0c
--- /dev/null
+++ b/group16/542087872/out/production/coding2017/com/coderising/litestruts/struts.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<struts>
+    <action name="login" class="com.coderising.action.LoginAction">
+        <result name="success">/jsp/homepage.jsp</result>
+        <result name="fail">/jsp/showLogin.jsp</result>
+    </action>
+    <action name="logout" class="com.coderising.action.LogoutAction">
+    	<result = "success">/jsp/welcome.jsp</result>
+    	<result = "error">/jsp/error.jsp</result>
+    </action>
+</struts>
\ No newline at end of file
diff --git a/group16/542087872/out/production/coding2017/net/coding/coderising/litestruts/struts.xml b/group16/542087872/out/production/coding2017/net/coding/coderising/litestruts/struts.xml
new file mode 100644
index 0000000000..848f04cfba
--- /dev/null
+++ b/group16/542087872/out/production/coding2017/net/coding/coderising/litestruts/struts.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<struts>
+    <action name="login" class="net.coding.coderising.litestruts.LoginAction">
+        <result name="success">/jsp/homepage.jsp</result>
+        <result name="fail">/jsp/showLogin.jsp</result>
+    </action>
+    <action name="logout" class="net.coding.coderising.litestruts.LogoutAction">
+    	<result name="success">/jsp/welcome.jsp</result>
+    	<result name="error">/jsp/error.jsp</result>
+    </action>
+</struts>
\ No newline at end of file
diff --git a/group16/542087872/src/com/coding/basic/ArrayList.java b/group16/542087872/src/net/coding/basic/ArrayList.java
similarity index 98%
rename from group16/542087872/src/com/coding/basic/ArrayList.java
rename to group16/542087872/src/net/coding/basic/ArrayList.java
index 1b10b441cf..a0286827d6 100644
--- a/group16/542087872/src/com/coding/basic/ArrayList.java
+++ b/group16/542087872/src/net/coding/basic/ArrayList.java
@@ -1,4 +1,4 @@
-package com.coding.basic;
+package net.coding.basic;
 
 import java.util.Arrays;
 
diff --git a/group16/542087872/src/com/coding/basic/BinaryTreeNode.java b/group16/542087872/src/net/coding/basic/BinaryTreeNode.java
similarity index 97%
rename from group16/542087872/src/com/coding/basic/BinaryTreeNode.java
rename to group16/542087872/src/net/coding/basic/BinaryTreeNode.java
index df167343a0..4cac873d08 100644
--- a/group16/542087872/src/com/coding/basic/BinaryTreeNode.java
+++ b/group16/542087872/src/net/coding/basic/BinaryTreeNode.java
@@ -1,4 +1,4 @@
-package com.coding.basic;
+package net.coding.basic;
 
 public class BinaryTreeNode {
 	
diff --git a/group16/542087872/src/com/coding/basic/Iterator.java b/group16/542087872/src/net/coding/basic/Iterator.java
similarity index 75%
rename from group16/542087872/src/com/coding/basic/Iterator.java
rename to group16/542087872/src/net/coding/basic/Iterator.java
index 06ef6311b2..ca3fd054ae 100644
--- a/group16/542087872/src/com/coding/basic/Iterator.java
+++ b/group16/542087872/src/net/coding/basic/Iterator.java
@@ -1,4 +1,4 @@
-package com.coding.basic;
+package net.coding.basic;
 
 public interface Iterator {
 	public boolean hasNext();
diff --git a/group16/542087872/src/com/coding/basic/LinkedList.java b/group16/542087872/src/net/coding/basic/LinkedList.java
similarity index 99%
rename from group16/542087872/src/com/coding/basic/LinkedList.java
rename to group16/542087872/src/net/coding/basic/LinkedList.java
index 144af4ec8d..0f9d326545 100644
--- a/group16/542087872/src/com/coding/basic/LinkedList.java
+++ b/group16/542087872/src/net/coding/basic/LinkedList.java
@@ -1,4 +1,4 @@
-package com.coding.basic;
+package net.coding.basic;
 
 public class LinkedList implements List {
 
diff --git a/group16/542087872/src/com/coding/basic/List.java b/group16/542087872/src/net/coding/basic/List.java
similarity index 87%
rename from group16/542087872/src/com/coding/basic/List.java
rename to group16/542087872/src/net/coding/basic/List.java
index 10d13b5832..189fe091d8 100644
--- a/group16/542087872/src/com/coding/basic/List.java
+++ b/group16/542087872/src/net/coding/basic/List.java
@@ -1,4 +1,4 @@
-package com.coding.basic;
+package net.coding.basic;
 
 public interface List {
 	public void add(Object o);
diff --git a/group16/542087872/src/com/coding/basic/Queue.java b/group16/542087872/src/net/coding/basic/Queue.java
similarity index 92%
rename from group16/542087872/src/com/coding/basic/Queue.java
rename to group16/542087872/src/net/coding/basic/Queue.java
index 8e4285464b..d233a02617 100644
--- a/group16/542087872/src/com/coding/basic/Queue.java
+++ b/group16/542087872/src/net/coding/basic/Queue.java
@@ -1,4 +1,4 @@
-package com.coding.basic;
+package net.coding.basic;
 
 public class Queue {
 
diff --git a/group16/542087872/src/com/coding/basic/Stack.java b/group16/542087872/src/net/coding/basic/Stack.java
similarity index 94%
rename from group16/542087872/src/com/coding/basic/Stack.java
rename to group16/542087872/src/net/coding/basic/Stack.java
index bfe98dd8b7..4a8099bcee 100644
--- a/group16/542087872/src/com/coding/basic/Stack.java
+++ b/group16/542087872/src/net/coding/basic/Stack.java
@@ -1,4 +1,4 @@
-package com.coding.basic;
+package net.coding.basic;
 
 public class Stack {
 	private ArrayList elementData = new ArrayList();
diff --git a/group16/542087872/src/com/coding/basic/Test.java b/group16/542087872/src/net/coding/basic/Test.java
similarity index 99%
rename from group16/542087872/src/com/coding/basic/Test.java
rename to group16/542087872/src/net/coding/basic/Test.java
index 2db5b2f9ab..d973793899 100644
--- a/group16/542087872/src/com/coding/basic/Test.java
+++ b/group16/542087872/src/net/coding/basic/Test.java
@@ -1,4 +1,4 @@
-package com.coding.basic;
+package net.coding.basic;
 
 
 /**
diff --git a/group16/542087872/src/net/coding/coderising/array/ArrayUtil.java b/group16/542087872/src/net/coding/coderising/array/ArrayUtil.java
new file mode 100644
index 0000000000..7cf4e1fd3f
--- /dev/null
+++ b/group16/542087872/src/net/coding/coderising/array/ArrayUtil.java
@@ -0,0 +1,203 @@
+package net.coding.coderising.array;
+
+public class ArrayUtil {
+	
+	/**
+	 * 给定一个整形数组a , 对该数组的值进行置换
+		例如： a = [7, 9 , 30, 3]  ,   置换后为 [3, 30, 9,7]
+		如果     a = [7, 9, 30, 3, 4] , 置换后为 [4,3, 30 , 9,7]
+	 * @param origin
+	 * @return
+	 */
+	public void reverseArray(int[] origin){
+		int l = 0, r = origin.length - 1;
+		while (l < r) {
+			int tmp = origin[l];
+			origin[l] = origin[r];
+			origin[r] = tmp;
+			l++;
+			r--;
+		}
+	}
+	
+	/**
+	 * 现在有如下的一个数组：   int oldArr[]={1,3,4,5,0,0,6,6,0,5,4,7,6,7,0,5}   
+	 * 要求将以上数组中值为0的项去掉，将不为0的值存入一个新的数组，生成的新数组为：   
+	 * {1,3,4,5,6,6,5,4,7,6,7,5}  
+	 * @param oldArray
+	 * @return
+	 */
+	
+	public int[] removeZero(int[] oldArray){
+		int cntZero = 0;
+		for (int i = 0; i < oldArray.length;i++) {
+			if (oldArray[i] == 0) {
+				cntZero ++;
+			}
+		}
+		if (cntZero == 0) {
+			return oldArray;
+		}
+
+		int[] newArray = new int[oldArray.length - cntZero];
+		int j = 0;
+		for (int i = 0; i < oldArray.length;i++) {
+			if (oldArray[i] != 0) {
+				newArray[j++] = oldArray[i];
+			}
+		}
+
+		return newArray;
+	}
+	
+	/**
+	 * 给定两个已经排序好的整形数组， a1和a2 ,  创建一个新的数组a3, 使得a3 包含a1和a2 的所有元素， 并且仍然是有序的
+	 * 例如 a1 = [3, 5, 7,8]   a2 = [4, 5, 6,7]    则 a3 为[3,4,5,6,7,8]    , 注意： 已经消除了重复
+	 * @param array1
+	 * @param array2
+	 * @return
+	 */
+	
+	public int[] merge(int[] array1, int[] array2){
+		int[] result = new int[array1.length + array2.length];
+		int l = 0;
+		int r = 0;
+
+		int cnt = 0;
+		while (true) {
+			if (l >= array1.length && r >= array2.length) {
+				break;
+			}
+			if (l >= array1.length) {
+				result[cnt++] = array2[r];
+				r++;
+			} else if (r >= array1.length) {
+				result[cnt++] = array1[l];
+				l++;
+			} else {
+				if (array1[l] < array2[r]) {
+					result[cnt++] = array1[l];
+					l++;
+				} else {
+					result[cnt++] = array2[r];
+					r++;
+				}
+			}
+		}
+
+		return  result;
+	}
+	/**
+	 * 把一个已经存满数据的数组 oldArray的容量进行扩展， 扩展后的新数据大小为oldArray.length + size
+	 * 注意，老数组的元素在新数组中需要保持
+	 * 例如 oldArray = [2,3,6] , size = 3,则返回的新数组为
+	 * [2,3,6,0,0,0]
+	 * @param oldArray
+	 * @param size
+	 * @return
+	 */
+	public int[] grow(int [] oldArray,  int size){
+		int[] result = new int[oldArray.length + size];
+		System.arraycopy(oldArray, 0, result, 0, oldArray.length);
+		return result;
+	}
+	
+	/**
+	 * 斐波那契数列为：1，1，2，3，5，8，13，21......  ，给定一个最大值， 返回小于该值的数列
+	 * 例如， max = 15 , 则返回的数组应该为 [1，1，2，3，5，8，13]
+	 * max = 1, 则返回空数组 []
+	 * @param max
+	 * @return
+	 */
+	public int[] fibonacci(int max){
+		int[] result = {};
+		int a = 0;
+		int b = 1;
+
+		int cnt = 0;
+		while (b < max) {
+			result = grow(result, 1);
+			result[cnt++] = b;
+			int tmp = a + b;
+			a = b;
+			b = tmp;
+		}
+
+		return result;
+	}
+	
+	/**
+	 * 返回小于给定最大值max的所有素数数组
+	 * 例如max = 23, 返回的数组为[1,2,3,5,7,11,13,17,19]
+	 * @param max
+	 * @return
+	 */
+	private boolean isPrime(int n) {
+		for (int i = 2; i <= Math.sqrt(n + 1.0); i++) {
+			if (n % i == 0) {
+				return false;
+			}
+		}
+		return true;
+	}
+	public int[] getPrimes(int max){
+		int[] result = {};
+		int cnt = 0;
+		for (int i = 1; i < max; i++) {
+			if (isPrime(i)) {
+				result = grow(result, 1);
+				result[cnt++] = i;
+			}
+		}
+		return result;
+	}
+	
+	/**
+	 * 所谓“完数”， 是指这个数恰好等于它的因子之和，例如6=1+2+3
+	 * 给定一个最大值max， 返回一个数组， 数组中是小于max 的所有完数
+	 * @param max
+	 * @return
+	 */
+	private boolean isPerfect(int n) {
+		int total = 0;
+		for (int i = 1; i < n; i++) {
+			if (n % i == 0) {
+				total += i;
+			}
+		}
+
+		return total == n;
+	}
+	public int[] getPerfectNumbers(int max){
+		int[] result = {};
+		int cnt = 0;
+		for (int i = 1; i < max; i++) {
+			if (isPerfect(i)) {
+				result = grow(result, 1);
+				result[cnt++] = i;
+			}
+		}
+		return result;
+	}
+	
+	/**
+	 * 用seperator 把数组 array给连接起来
+	 * 例如array= [3,8,9], seperator = "-"
+	 * 则返回值为"3-8-9"
+	 * @param array
+	 * @param s
+	 * @return
+	 */
+	public String join(int[] array, String seperator){
+		StringBuilder sb = new StringBuilder();
+		for (int i = 0; i < array.length; i++) {
+			if (sb.length() > 0) {
+				sb.append(seperator);
+			}
+			sb.append(array[i]);
+		}
+		return sb.toString();
+	}
+	
+
+}
diff --git a/group16/542087872/src/net/coding/coderising/array/ArrayUtilTest.java b/group16/542087872/src/net/coding/coderising/array/ArrayUtilTest.java
new file mode 100644
index 0000000000..0ae290bbfd
--- /dev/null
+++ b/group16/542087872/src/net/coding/coderising/array/ArrayUtilTest.java
@@ -0,0 +1,76 @@
+package net.coding.coderising.array;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Created by xiaoyuan on 02/03/2017.
+ */
+public class ArrayUtilTest {
+
+    @Test
+    public void testReverseArray() {
+        int[] nums = {1, 2, 3};
+        new ArrayUtil().reverseArray(nums);
+        Assert.assertArrayEquals(nums, new int[]{3, 2, 1});
+    }
+    // removeZero
+    @Test
+    public void testRemoveZero() {
+        int[] nums = {0, 1, 0, 2, 3};
+        int[] ans = new ArrayUtil().removeZero(nums);
+        Assert.assertArrayEquals(ans, new int[]{1, 2, 3});
+    }
+
+    // merge
+    @Test
+    public void testMerge() {
+        int[] nums1 = {1, 3, 9};
+        int[] nums2 = {2, 4, 5};
+        int[] ans = new ArrayUtil().merge(nums1, nums2);
+        Assert.assertArrayEquals(ans, new int[]{1, 2, 3, 4, 5, 9});
+    }
+
+    // grow
+    @Test
+    public void testGrow() {
+        int[] nums = {1, 3, 9};
+        int[] ans = new ArrayUtil().grow(nums, 2);
+        Assert.assertArrayEquals(ans, new int[]{1, 3, 9, 0, 0});
+    }
+
+    // fibonacci
+    @Test
+    public void testFibonacci() {
+        int[] ans = new ArrayUtil().fibonacci(10);
+        Assert.assertArrayEquals(ans, new int[]{1, 1, 2, 3, 5, 8});
+    }
+
+
+    // getPrimes
+    @Test
+    public void testgetPrimes() {
+        int[] ans = new ArrayUtil().getPrimes(10);
+        Assert.assertArrayEquals(ans, new int[]{1, 2, 3, 5, 7});
+    }
+
+
+    // getPerfectNumbers
+    @Test
+    public void testGetPerfectNumbers() {
+        int[] ans = new ArrayUtil().getPerfectNumbers(10);
+        Assert.assertArrayEquals(ans, new int[]{6});
+    }
+
+
+    // join
+
+    @Test
+    public void testJoin() {
+        String ans = new ArrayUtil().join(new int[]{1, 3, 4}, "-");
+        Assert.assertEquals(ans, "1-3-4");
+    }
+
+
+
+}
diff --git a/group16/542087872/src/net/coding/coderising/litestruts/LoginAction.java b/group16/542087872/src/net/coding/coderising/litestruts/LoginAction.java
new file mode 100644
index 0000000000..5e4f956c2f
--- /dev/null
+++ b/group16/542087872/src/net/coding/coderising/litestruts/LoginAction.java
@@ -0,0 +1,39 @@
+package net.coding.coderising.litestruts;
+
+/**
+ * 这是一个用来展示登录的业务类， 其中的用户名和密码都是硬编码的。
+ * @author liuxin
+ *
+ */
+public class LoginAction{
+    private String name ;
+    private String password;
+    private String message;
+
+    public String getName() {
+        return name;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public String execute(){
+            if("test".equals(name) && "1234".equals(password)){
+                this.message = "login successful";
+                return "success";
+            }
+            this.message = "login failed,please check your user/pwd";
+            return "fail";
+    }
+
+    public void setName(String name){
+        this.name = name;
+    }
+    public void setPassword(String password){
+        this.password = password;
+    }
+    public String getMessage(){
+        return this.message;
+    }
+}
diff --git a/group16/542087872/src/net/coding/coderising/litestruts/LogoutAction.java b/group16/542087872/src/net/coding/coderising/litestruts/LogoutAction.java
new file mode 100644
index 0000000000..560d8f4fd8
--- /dev/null
+++ b/group16/542087872/src/net/coding/coderising/litestruts/LogoutAction.java
@@ -0,0 +1,36 @@
+package net.coding.coderising.litestruts;
+
+/**
+ * Created by xiaoyuan on 02/03/2017.
+ */
+public class LogoutAction {
+
+    String ifLogout;
+    String message;
+
+    public String execute() {
+        if (ifLogout.equals("yes")) {
+            this.message = "success";
+            return "success";
+        } else {
+            this.message = "error";
+            return "error";
+        }
+    }
+
+    public String getIfLogout() {
+        return ifLogout;
+    }
+
+    public void setIfLogout(String ifLogout) {
+        this.ifLogout = ifLogout;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+}
diff --git a/group16/542087872/src/net/coding/coderising/litestruts/Struts.java b/group16/542087872/src/net/coding/coderising/litestruts/Struts.java
new file mode 100644
index 0000000000..1d9337f4f2
--- /dev/null
+++ b/group16/542087872/src/net/coding/coderising/litestruts/Struts.java
@@ -0,0 +1,126 @@
+package net.coding.coderising.litestruts;
+
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+
+public class Struts {
+
+    public static View runAction(String actionName, Map<String,String> parameters) {
+
+        /*
+         
+		0. 读取配置文件struts.xml
+ 		
+ 		1. 根据actionName找到相对应的class ， 例如LoginAction,   通过反射实例化（创建对象）
+		据parameters中的数据，调用对象的setter方法， 例如parameters中的数据是 
+		("name"="test" ,  "password"="1234") ,     	
+		那就应该调用 setName和setPassword方法
+		
+		2. 通过反射调用对象的exectue 方法， 并获得返回值，例如"success"
+		
+		3. 通过反射找到对象的所有getter方法（例如 getMessage）,  
+		通过反射来调用， 把值和属性形成一个HashMap , 例如 {"message":  "登录成功"} ,  
+		放到View对象的parameters
+		
+		4. 根据struts.xml中的 <result> 配置,以及execute的返回值，  确定哪一个jsp，  
+		放到View对象的jsp字段中。
+        
+        */
+
+        Map<String, String> name2ClassMap = new HashMap<String, String>();
+        Map<String, String> result2JSPMap = new HashMap<String, String>();
+
+
+        try {
+            File xmlFile = new File("group16/542087872/src/net/coding/coderising/litestruts/struts.xml");
+            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+            DocumentBuilder documentBuilder = factory.newDocumentBuilder();
+            Document doc = documentBuilder.parse(xmlFile);
+
+            doc.getDocumentElement().normalize();
+
+            NodeList actionList = doc.getElementsByTagName("action");
+            for (int i = 0; i < actionList.getLength(); i++) {
+                Node node = actionList.item(i);
+                System.out.println(node.getNodeName());
+                if (node.getNodeType() == Node.ELEMENT_NODE) {
+                    Element element = (Element)node;
+                    String acName = element.getAttribute("name");
+                    String acClass = element.getAttribute("class");
+                    name2ClassMap.put(acName, acClass);
+
+                    NodeList resultList = element.getElementsByTagName("result");
+                    for (int j = 0; j < resultList.getLength(); j++) {
+                        Element resultElemet = (Element)(resultList.item(j));
+                        String acResultName = resultElemet.getAttribute("name");
+                        String acResultJSP = resultElemet.getTextContent();
+
+                        result2JSPMap.put(acName + "_" + acResultName, acResultJSP);
+                    }
+                }
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new RuntimeException("parse XML ERROR!");
+        }
+
+        String classStr = name2ClassMap.get(actionName);
+        if (classStr == null) {
+            throw new RuntimeException("ACTION FOUND ERROR!");
+        }
+
+        try {
+            Class actionClass = Class.forName(classStr);
+            Object actionObj = actionClass.newInstance();
+            for (String key : parameters.keySet()) {
+                String value = parameters.get(key);
+                Method theMethod = actionClass.getMethod("set" + key.substring(0, 1).toUpperCase() + key.substring(1), String.class);
+                theMethod.invoke(actionObj, value);
+            }
+
+            // execut
+            Method exeMethod = actionClass.getMethod("execute");
+            String result = (String)exeMethod.invoke(actionObj);
+
+            // find JSP
+            String JSPPath = result2JSPMap.get(actionName + "_" + result);
+            View view = new View();
+            view.setJsp(JSPPath);
+
+            // generate map
+            Map map = new HashMap();
+            for(Method method: actionClass.getMethods()) {
+                if (method.getName().startsWith("get")) {
+                    Object key = method.getName().substring(3).toLowerCase();
+                    Object value = method.invoke(actionObj);
+                    map.put(key, value);
+                }
+            }
+            view.setParameters(map);
+
+            return view;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return null;
+    }
+
+    public static void main(String[] args) {
+        runAction(null, null);
+    }
+
+}
diff --git a/group16/542087872/src/net/coding/coderising/litestruts/StrutsTest.java b/group16/542087872/src/net/coding/coderising/litestruts/StrutsTest.java
new file mode 100644
index 0000000000..8c4de18ac4
--- /dev/null
+++ b/group16/542087872/src/net/coding/coderising/litestruts/StrutsTest.java
@@ -0,0 +1,70 @@
+package net.coding.coderising.litestruts;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+public class StrutsTest {
+
+	@Test
+	public void testLoginActionSuccess() {
+		
+		String actionName = "login";
+
+		Map<String,String> params = new HashMap<String,String>();
+        params.put("name","test");
+        params.put("password","1234");
+
+
+        View view  = Struts.runAction(actionName,params);
+
+        Assert.assertEquals("/jsp/homepage.jsp", view.getJsp());
+        Assert.assertEquals("login successful", view.getParameters().get("message"));
+	}
+
+	@Test
+	public void testLoginActionFailed() {
+		String actionName = "login";
+		Map<String,String> params = new HashMap<String,String>();
+        params.put("name","test");
+        params.put("password","123456"); //密码和预设的不一致
+
+        View view  = Struts.runAction(actionName,params);
+        
+        Assert.assertEquals("/jsp/showLogin.jsp", view.getJsp());
+        Assert.assertEquals("login failed,please check your user/pwd", view.getParameters().get("message"));
+	}
+
+
+    @Test
+    public void testLogoutActionSuccess() {
+        String actionName = "logout";
+
+        Map<String,String> params = new HashMap<String,String>();
+        params.put("ifLogout","yes");
+
+
+        View view  = Struts.runAction(actionName,params);
+
+        Assert.assertEquals("/jsp/welcome.jsp", view.getJsp());
+        Assert.assertEquals("success", view.getParameters().get("message"));
+    }
+
+    @Test
+    public void testLogoutActionError() {
+        String actionName = "logout";
+
+        Map<String,String> params = new HashMap<String,String>();
+        params.put("ifLogout","no");
+
+
+        View view  = Struts.runAction(actionName,params);
+
+        Assert.assertEquals("/jsp/error.jsp", view.getJsp());
+        Assert.assertEquals("error", view.getParameters().get("message"));
+    }
+
+}
diff --git a/group16/542087872/src/net/coding/coderising/litestruts/View.java b/group16/542087872/src/net/coding/coderising/litestruts/View.java
new file mode 100644
index 0000000000..63fb1d025e
--- /dev/null
+++ b/group16/542087872/src/net/coding/coderising/litestruts/View.java
@@ -0,0 +1,23 @@
+package net.coding.coderising.litestruts;
+
+import java.util.Map;
+
+public class View {
+	private String jsp;
+	private Map parameters;
+	
+	public String getJsp() {
+		return jsp;
+	}
+	public View setJsp(String jsp) {
+		this.jsp = jsp;
+		return this;
+	}
+	public Map getParameters() {
+		return parameters;
+	}
+	public View setParameters(Map parameters) {
+		this.parameters = parameters;
+		return this;
+	}
+}
diff --git a/group16/542087872/src/net/coding/coderising/litestruts/struts.xml b/group16/542087872/src/net/coding/coderising/litestruts/struts.xml
new file mode 100644
index 0000000000..848f04cfba
--- /dev/null
+++ b/group16/542087872/src/net/coding/coderising/litestruts/struts.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<struts>
+    <action name="login" class="net.coding.coderising.litestruts.LoginAction">
+        <result name="success">/jsp/homepage.jsp</result>
+        <result name="fail">/jsp/showLogin.jsp</result>
+    </action>
+    <action name="logout" class="net.coding.coderising.litestruts.LogoutAction">
+    	<result name="success">/jsp/welcome.jsp</result>
+    	<result name="error">/jsp/error.jsp</result>
+    </action>
+</struts>
\ No newline at end of file

From 64367c857d09464aa2da8103586d238ce1c8e5d0 Mon Sep 17 00:00:00 2001
From: duxl <adu1528838@126.com>
Date: Fri, 3 Mar 2017 15:44:07 +0800
Subject: [PATCH 28/36] =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=BA=86=E8=AF=BB?=
 =?UTF-8?q?=E5=8F=96xml=E6=96=87=E4=BB=B6=E7=9A=84=E7=BC=96=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

完成了读取xml文件的编码
---
 .../coderising/litestruts/LoginAction.java    |  22 ++--
 .../src/com/coderising/litestruts/Struts.java | 114 ++++++++++++++----
 .../com/coderising/litestruts/StrutsTest.java |   9 +-
 .../src/com/coderising/litestruts/struts.xml  |   8 +-
 4 files changed, 107 insertions(+), 46 deletions(-)

diff --git a/group16/1287642108/0305/src/com/coderising/litestruts/LoginAction.java b/group16/1287642108/0305/src/com/coderising/litestruts/LoginAction.java
index 1005f35a29..904daea228 100644
--- a/group16/1287642108/0305/src/com/coderising/litestruts/LoginAction.java
+++ b/group16/1287642108/0305/src/com/coderising/litestruts/LoginAction.java
@@ -14,9 +14,21 @@ public String getName() {
         return name;
     }
 
+    public void setName(String name){
+        this.name = name;
+    }
+    
     public String getPassword() {
         return password;
     }
+    
+    public void setPassword(String password){
+        this.password = password;
+    }
+    
+    public String getMessage(){
+        return this.message;
+    }
 
     public String execute(){
             if("test".equals(name) && "1234".equals(password)){
@@ -26,14 +38,4 @@ public String execute(){
             this.message = "login failed,please check your user/pwd";
             return "fail";
     }
-
-    public void setName(String name){
-        this.name = name;
-    }
-    public void setPassword(String password){
-        this.password = password;
-    }
-    public String getMessage(){
-        return this.message;
-    }
 }
diff --git a/group16/1287642108/0305/src/com/coderising/litestruts/Struts.java b/group16/1287642108/0305/src/com/coderising/litestruts/Struts.java
index 44cc35bf01..229fb5145c 100644
--- a/group16/1287642108/0305/src/com/coderising/litestruts/Struts.java
+++ b/group16/1287642108/0305/src/com/coderising/litestruts/Struts.java
@@ -1,34 +1,96 @@
 package com.coderising.litestruts;
 
+import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
 import java.util.Map;
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.Element;
+import org.dom4j.Node;
+import org.dom4j.io.SAXReader;
+
+public class Struts {
+    public static View runAction(String actionName, Map<String,String> parameters) throws ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
+        //创建SAXReader读取器，专门用于读取xml  
+    	SAXReader saxReader = new SAXReader();  
+        Document document = null;
+		try {
+			 document = saxReader.read(new File("D:/DemoSpace/coding2017/group16/1287642108/0305/src/com/coderising/litestruts/struts.xml"));
+			 Element root = document.getRootElement(); 
+			 //根据节点名称找节点
+			 Node node = root.selectSingleNode("action[@name='"+actionName+"']");
+			 String classPath = ((Element) node).attributeValue("class");
+			 //根据类名反射实例化
+			 Class<?> onwClass = Class.forName(classPath);
+			 Object o = onwClass.newInstance();
+			 Method setName = onwClass.getMethod("setName",String.class);
+	         Method setPassword = onwClass.getMethod("setPassword",String.class);
+	         Method execute = onwClass.getMethod("execute");
+	         Method getName = onwClass.getMethod("getName");
+	         Method getPassword = onwClass.getMethod("getPassword");
+	         Method getMessage = onwClass.getMethod("getMessage");
+	         setName.invoke(o,parameters.get("name"));
+	         setPassword.invoke(o,parameters.get("password"));
+	         String result = (String) execute.invoke(o);
+	         //组装params参数
+	         HashMap<String,String> map = new HashMap<>();
+	         String name = (String) getName.invoke(o);
+	         String password = (String) getPassword.invoke(o);
+	         String message = (String) getMessage.invoke(o);
+	         map.put("name", name);
+	         map.put("password", password);
+	         map.put("message", message);
+	         //组装view数据
+	         View view = new View();
+	         view.setParameters(map);
+	         //根据execute的返回值，找对应的jsp页面路径
+	         String jspPath = node.valueOf("//result[@name='"+result+"']");
+	         view.setJsp(jspPath);
+	         return view;
+		} catch (DocumentException e) {
+			e.printStackTrace();
+		}
+    	return null;
+    }   
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
-public class Struts {
 
-    public static View runAction(String actionName, Map<String,String> parameters) {
-
-        /*
-         
-		0. 读取配置文件struts.xml
- 		
- 		1. 根据actionName找到相对应的class ， 例如LoginAction,   通过反射实例化（创建对象）
-		据parameters中的数据，调用对象的setter方法， 例如parameters中的数据是 
-		("name"="test" ,  "password"="1234") ,     	
-		那就应该调用 setName和setPassword方法
-		
-		2. 通过反射调用对象的exectue 方法， 并获得返回值，例如"success"
-		
-		3. 通过反射找到对象的所有getter方法（例如 getMessage）,  
-		通过反射来调用， 把值和属性形成一个HashMap , 例如 {"message":  "登录成功"} ,  
-		放到View对象的parameters
-		
-		4. 根据struts.xml中的 <result> 配置,以及execute的返回值，  确定哪一个jsp，  
-		放到View对象的jsp字段中。
-        
-        */
-    	
-    	return null;
-    }    
 
-}
diff --git a/group16/1287642108/0305/src/com/coderising/litestruts/StrutsTest.java b/group16/1287642108/0305/src/com/coderising/litestruts/StrutsTest.java
index a44c1878ac..2a8ed76022 100644
--- a/group16/1287642108/0305/src/com/coderising/litestruts/StrutsTest.java
+++ b/group16/1287642108/0305/src/com/coderising/litestruts/StrutsTest.java
@@ -1,19 +1,16 @@
 package com.coderising.litestruts;
 
+import java.lang.reflect.InvocationTargetException;
 import java.util.HashMap;
 import java.util.Map;
 
 import org.junit.Assert;
 import org.junit.Test;
 
-
-
-
-
 public class StrutsTest {
 
 	@Test
-	public void testLoginActionSuccess() {
+	public void testLoginActionSuccess() throws ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
 		
 		String actionName = "login";
         
@@ -29,7 +26,7 @@ public void testLoginActionSuccess() {
 	}
 
 	@Test
-	public void testLoginActionFailed() {
+	public void testLoginActionFailed() throws ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
 		String actionName = "login";
 		Map<String,String> params = new HashMap<String,String>();
         params.put("name","test");
diff --git a/group16/1287642108/0305/src/com/coderising/litestruts/struts.xml b/group16/1287642108/0305/src/com/coderising/litestruts/struts.xml
index 99063bcb0c..e22003fc12 100644
--- a/group16/1287642108/0305/src/com/coderising/litestruts/struts.xml
+++ b/group16/1287642108/0305/src/com/coderising/litestruts/struts.xml
@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <struts>
-    <action name="login" class="com.coderising.action.LoginAction">
+    <action name="login" class="com.coderising.litestruts.LoginAction">
         <result name="success">/jsp/homepage.jsp</result>
         <result name="fail">/jsp/showLogin.jsp</result>
     </action>
     <action name="logout" class="com.coderising.action.LogoutAction">
-    	<result = "success">/jsp/welcome.jsp</result>
-    	<result = "error">/jsp/error.jsp</result>
+    	<result name="success">/jsp/welcome.jsp</result>
+    	<result name="error">/jsp/error.jsp</result>
     </action>
-</struts>
\ No newline at end of file
+</struts> 
\ No newline at end of file

From ab8ba87fb7c6306b5932b24fdac311c51fe93298 Mon Sep 17 00:00:00 2001
From: duxl <adu1528838@126.com>
Date: Fri, 3 Mar 2017 15:46:45 +0800
Subject: [PATCH 29/36] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=A0=BC=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

调整格式
---
 .../src/com/coderising/litestruts/Struts.java | 39 -------------------
 1 file changed, 39 deletions(-)

diff --git a/group16/1287642108/0305/src/com/coderising/litestruts/Struts.java b/group16/1287642108/0305/src/com/coderising/litestruts/Struts.java
index 229fb5145c..cb20956a88 100644
--- a/group16/1287642108/0305/src/com/coderising/litestruts/Struts.java
+++ b/group16/1287642108/0305/src/com/coderising/litestruts/Struts.java
@@ -55,42 +55,3 @@ public static View runAction(String actionName, Map<String,String> parameters) t
     	return null;
     }   
 }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-

From 78e0a664acc9a3e46e11880f5b9ee85509fdb980 Mon Sep 17 00:00:00 2001
From: gaodekui <13526428940@163.com>
Date: Fri, 3 Mar 2017 16:56:45 +0800
Subject: [PATCH 30/36] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8D=95=E5=85=83?=
 =?UTF-8?q?=E6=B5=8B=E8=AF=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../1154151360/src/com/array/ArrayUtil.java   |   4 +-
 .../src/com/array/ArrayUtilTest.java          | 102 ++++++++++++++++++
 2 files changed, 105 insertions(+), 1 deletion(-)
 create mode 100644 group16/1154151360/src/com/array/ArrayUtilTest.java

diff --git a/group16/1154151360/src/com/array/ArrayUtil.java b/group16/1154151360/src/com/array/ArrayUtil.java
index 8ddc93d495..39f587c847 100644
--- a/group16/1154151360/src/com/array/ArrayUtil.java
+++ b/group16/1154151360/src/com/array/ArrayUtil.java
@@ -19,7 +19,7 @@ public class ArrayUtil {
 	 * @param origin
 	 * @return
 	 */
-	public void reverseArray(int[] origin){
+	public int[] reverseArray(int[] origin){
 		
 		int [] temp = new int [origin.length];
 		
@@ -28,6 +28,8 @@ public void reverseArray(int[] origin){
 		}
 		
 		origin = temp;
+		
+		return origin;
 	}
 	
 	/**
diff --git a/group16/1154151360/src/com/array/ArrayUtilTest.java b/group16/1154151360/src/com/array/ArrayUtilTest.java
new file mode 100644
index 0000000000..159d497b6d
--- /dev/null
+++ b/group16/1154151360/src/com/array/ArrayUtilTest.java
@@ -0,0 +1,102 @@
+package com.array;
+
+import static org.junit.Assert.*;
+import junit.framework.Assert;
+
+import org.junit.Before;
+import org.junit.Test;
+@SuppressWarnings("deprecation")
+public class ArrayUtilTest {
+
+	ArrayUtil util;
+	
+	@Before
+	public void init(){
+		util = new ArrayUtil();
+	}
+	
+	@Test
+	public void test_reverseArray() {
+		int [] a = {7, 9, 30, 3, 4};
+		a = util.reverseArray(a);
+		Assert.assertEquals("[4,3,30,9,7]", toString(a));
+	}
+	
+	@Test
+	public void test_removeZero(){
+		int [] oldArr={1,3,4,5,0,0,6,6,0,5,4,7,6,7,0,5};
+		
+		oldArr = util.removeZero(oldArr);
+		
+		Assert.assertEquals("[1,3,4,5,6,6,5,4,7,6,7,5]", toString(oldArr));
+	}
+	
+	
+	@Test
+	public void test_merge(){
+		int [] a1 = {3, 5, 7,8};
+		int [] a2 = {4, 5, 6,7};
+		int [] a3 = util.merge(a1, a2);
+		
+		Assert.assertEquals("[3,4,5,6,7,8]", toString(a3));
+
+	}
+	
+	@Test
+	public void test_grow(){
+		int [] oldArray = {2,3,6};
+		int size = 3;
+		int [] newArray = util.grow(oldArray, size);
+		
+		Assert.assertEquals("[2,3,6,0,0,0]", toString(newArray));
+	}
+	
+	
+	@Test
+	public void test_fibonacci(){
+		
+		int [] array = util.fibonacci(15);
+		
+		Assert.assertEquals("[1，1，2，3，5，8，13]", toString(array));
+
+	}
+	
+	
+	@Test
+	public void test_getPrimes(){
+		
+		int [] array = util.getPrimes(23);
+		Assert.assertEquals("[2,3,5,7,11,13,17,19]", toString(array));
+
+	}
+	
+	@Test
+	public void test_getPerfectNumbers(){
+		int [] array = util.getPerfectNumbers(10);
+		
+		Assert.assertEquals("[6]", toString(array));
+
+	}
+	
+	@Test
+	public void test_join(){
+		
+		int [] array = {3,8,9};
+		String result = util.join(array, "-");
+		Assert.assertEquals("3-8-9", result);
+	}
+	
+	
+	public String toString(int [] array){
+		StringBuilder builder = new StringBuilder();
+		builder.append("[");
+		for(int item: array){
+			builder.append(item)
+					.append(",");
+		}
+		builder.replace(builder.length() - 1, builder.length(), "");
+		builder.append("]");
+		return builder.toString();
+		
+	}
+}

From e10e60e141fd6e2f737c3144b989561f5c226286 Mon Sep 17 00:00:00 2001
From: dongqihust <dongqihust@gmail.com>
Date: Fri, 3 Mar 2017 23:06:39 +0800
Subject: [PATCH 31/36] =?UTF-8?q?=E5=AE=8C=E6=88=90=E7=BC=96=E7=A8=8B?=
 =?UTF-8?q?=E9=A2=98=E7=9B=AE=E4=BD=9C=E4=B8=9A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../src/com/coderising/array/ArrayUtil.java   | 273 ++++++++++++++++++
 .../com/coderising/array/ArrayUtilTest.java   |  80 +++++
 .../src/com/coderising/litestruts/Action.java |  36 +++
 .../coderising/litestruts/LoginAction.java    |  39 +++
 .../src/com/coderising/litestruts/Struts.java | 246 ++++++++++++++++
 .../com/coderising/litestruts/StrutsTest.java |  48 +++
 .../src/com/coderising/litestruts/View.java   |  23 ++
 .../src/com/coderising/litestruts/struts.xml  |  11 +
 8 files changed, 756 insertions(+)
 create mode 100644 group16/1325756593/src/com/coderising/array/ArrayUtil.java
 create mode 100644 group16/1325756593/src/com/coderising/array/ArrayUtilTest.java
 create mode 100644 group16/1325756593/src/com/coderising/litestruts/Action.java
 create mode 100644 group16/1325756593/src/com/coderising/litestruts/LoginAction.java
 create mode 100644 group16/1325756593/src/com/coderising/litestruts/Struts.java
 create mode 100644 group16/1325756593/src/com/coderising/litestruts/StrutsTest.java
 create mode 100644 group16/1325756593/src/com/coderising/litestruts/View.java
 create mode 100644 group16/1325756593/src/com/coderising/litestruts/struts.xml

diff --git a/group16/1325756593/src/com/coderising/array/ArrayUtil.java b/group16/1325756593/src/com/coderising/array/ArrayUtil.java
new file mode 100644
index 0000000000..0f67e6b54f
--- /dev/null
+++ b/group16/1325756593/src/com/coderising/array/ArrayUtil.java
@@ -0,0 +1,273 @@
+package com.coderising.array;
+
+import static org.hamcrest.CoreMatchers.nullValue;
+
+import java.util.Arrays;
+
+import com.dong.week1.ArrayList;
+
+public class ArrayUtil {
+	
+	/**
+	 * 给定一个整形数组a , 对该数组的值进行置换
+		例如： a = [7, 9 , 30, 3]  ,   置换后为 [3, 30, 9,7]
+		如果     a = [7, 9, 30, 3, 4] , 置换后为 [4,3, 30 , 9,7]
+	 * @param origin
+	 * @return
+	 */
+	public void reverseArray(int[] origin){
+		if(origin==null||origin.length==0){
+			return;
+		}
+		int len = origin.length;
+		for(int i=0;i<len/2;i++){
+			int temp = origin[i];
+			origin[i]=origin[len-i-1];
+			origin[len-i-1]=temp;
+		}
+		
+	}
+	
+	/**
+	 * 现在有如下的一个数组：   int oldArr[]={1,3,4,5,0,0,6,6,0,5,4,7,6,7,0,5}   
+	 * 要求将以上数组中值为0的项去掉，将不为0的值存入一个新的数组，生成的新数组为：   
+	 * {1,3,4,5,6,6,5,4,7,6,7,5}  
+	 * @param oldArray
+	 * @return
+	 */
+	
+	public int[] removeZero(int[] oldArray){
+		int newArrayLen=0;
+		int len = oldArray.length;
+		for(int i=0;i<len;i++){
+			if(oldArray[i]!=0){
+				newArrayLen++;
+			}
+		}
+		int[] retArray = new int[newArrayLen];
+		int retIndex=0;
+		for(int i=0;i<len;i++){
+			if(oldArray[i]!=0){
+				retArray[retIndex++]=oldArray[i];
+			}
+		}
+		return retArray;
+	}
+	
+	/**
+	 * 给定两个已经排序好的整形数组， a1和a2 ,  创建一个新的数组a3, 使得a3 包含a1和a2 的所有元素， 并且仍然是有序的
+	 * 例如 a1 = [3, 5, 7,8]   a2 = [4, 5, 6,7]    则 a3 为[3,4,5,6,7,8]    , 注意： 已经消除了重复
+	 * @param array1
+	 * @param array2
+	 * @return
+	 */
+	
+	public int[] merge(int[] array1, int[] array2){
+		int len1 = array1.length;
+		int len2 = array2.length;	
+		int index1=0,index2=0;
+		ArrayList arrayList = new ArrayList();
+		while(index1<len1&&index2<len2){
+		
+			if(array1[index1]>array2[index2]){
+				arrayList.add(array2[index2]);
+				index2++;
+			}else if(array1[index1]==array2[index2]){
+				arrayList.add(array2[index2]);
+				index1++;
+				index2++;
+			}
+			else{
+				arrayList.add(array1[index1]);			
+				index1++;
+			}			
+		}
+		if(index1==len1){
+			for(int i=index2;i<len2;i++){
+				arrayList.add(array2[i]);
+			}
+			
+		}else{
+			for(int i=index1;i<len1;i++){
+				arrayList.add(array1[i]);
+			}
+		}
+		return ListToArray(arrayList);
+	}
+	
+	/**
+	 * 把一个已经存满数据的数组 oldArray的容量进行扩展， 扩展后的新数据大小为oldArray.length + size
+	 * 注意，老数组的元素在新数组中需要保持
+	 * 例如 oldArray = [2,3,6] , size = 3,则返回的新数组为
+	 * [2,3,6,0,0,0]
+	 * @param oldArray
+	 * @param size
+	 * @return
+	 */
+	public int[] grow(int [] oldArray,  int size){
+		
+		return Arrays.copyOf(oldArray, oldArray.length+size);
+		
+	}
+	
+	/**
+	 * 斐波那契数列为：1，1，2，3，5，8，13，21......  ，给定一个最大值， 返回小于该值的数列
+	 * 例如， max = 15 , 则返回的数组应该为 [1，1，2，3，5，8，13]
+	 * max = 1, 则返回空数组 []
+	 * @param max
+	 * @return
+	 */
+	public int[] fibonacci(int max){
+		ArrayList arrayList = new ArrayList();
+		int first=1;
+		int second=1;
+		int third=0;
+		for(int i=1;i<max;i++){	
+			if(i==1){
+				arrayList.add(first);
+				arrayList.add(second);
+			}			
+			third= first+second;
+			if(third>=max){
+				break;
+			}
+			arrayList.add(third);
+			first = second;
+			second=third;
+			
+			
+		}
+		return ListToArray(arrayList);
+	}
+	
+	/**
+	 * 返回小于给定最大值max的所有素数数组
+	 * 例如max = 23, 返回的数组为[2,3,5,7,11,13,17,19]
+	 * @param max
+	 * @return
+	 */
+	public int[] getPrimes(int max){
+		ArrayList arrayList = new ArrayList();
+		for(int i=2;i<max;i++){
+			if(isPrime(i)){
+				arrayList.add(i);
+			}
+		}
+		return ListToArray(arrayList);
+	}
+	
+	public int[] getAbsolutePrimes(int max){
+		ArrayList arrayList = new ArrayList();
+		for(int i=2;i<=max;i++){
+			if(isPrime(i)){
+				arrayList.add(i);
+			}
+		}		
+		return ListToArray(arrayList);
+	}
+	
+	public static int[] ListToArray(ArrayList arrayList){
+		if(arrayList==null){
+			return null;
+		}
+		int[] retArray = new int[arrayList.size()];
+		for(int i=0;i<retArray.length;i++){
+			retArray[i] =(int) arrayList.get(i);
+		}
+		return retArray;
+	}
+	
+	
+	
+	private boolean isPrime(int input){
+		
+		if(input==2){
+			return true;
+		}
+		for(int i=2;i<=Math.sqrt(input);i++){
+			if(input%i==0){
+				return false;
+			}
+		}
+		return true;
+	}
+	
+	/**
+	 * 所谓“完数”， 是指这个数恰好等于它的因子之和，例如6=1+2+3
+	 * 给定一个最大值max， 返回一个数组， 数组中是小于max 的所有完数
+	 * @param max
+	 * @return
+	 */
+	public int[] getPerfectNumbers(int max){
+		ArrayList arrayList = new ArrayList();
+		if(max==1){
+			arrayList.add(1);
+		}
+		for(int i=1;i<max;i++){
+			if (new ArrayUtil().isPerfect(i)) {
+				arrayList.add(i);
+			}
+		}
+		
+		 return ListToArray(arrayList);
+	}
+	
+	
+	public boolean isPerfect(int i){
+		int itemp = i;
+		if(i==1){
+			return true;
+		}
+		int[] primes = this.getAbsolutePrimes(i);
+		ArrayList arrayList = new ArrayList();
+		arrayList.add(1);
+		
+		
+		while(i!=1){
+			for(int div:primes){
+				if(i%div==0){
+					arrayList.add(div);
+					i=i/div;
+				}
+			}
+		}
+		int sum = getSum(arrayList);
+		if(sum==itemp){
+			return true;
+		}
+		return false;
+	}
+
+	private int getSum(ArrayList arrayList) {
+		int sum = 0;
+		for(int j=0;j<arrayList.size();j++){
+			sum += (int)arrayList.get(j);
+		}
+		return sum;
+	}
+	
+	/**
+	 * 用seperator 把数组 array给连接起来
+	 * 例如array= [3,8,9], seperator = "-"
+	 * 则返回值为""3-8-9
+	 * @param array
+	 * @param s
+	 * @return
+	 */
+	public String join(int[] array, String seperator){
+		StringBuffer sb = new StringBuffer();
+		if(array==null){
+			return null;
+		}else{
+			for(int i=0;i<array.length;i++){
+				sb.append(array[i]);
+				if(i!=array.length-1){
+					sb.append(seperator);
+				}
+			}
+		}
+		return sb.toString();
+	}
+	
+
+}
diff --git a/group16/1325756593/src/com/coderising/array/ArrayUtilTest.java b/group16/1325756593/src/com/coderising/array/ArrayUtilTest.java
new file mode 100644
index 0000000000..13d1989851
--- /dev/null
+++ b/group16/1325756593/src/com/coderising/array/ArrayUtilTest.java
@@ -0,0 +1,80 @@
+package com.coderising.array;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class ArrayUtilTest {
+
+	@Test
+	public void testReverseArray() {
+		int[] input = {7, 9 , 30, 3};
+		new ArrayUtil().reverseArray(input);
+		int[] inputResult = {3, 30, 9,7};
+		assertArrayEquals(inputResult, input);
+		
+		int[] input1 = {7, 9, 30, 3, 4};
+		new ArrayUtil().reverseArray(input1);
+		int[] inputResult1 = {4,3, 30 , 9,7};
+		assertArrayEquals(inputResult1, input1);
+	}
+	
+	@Test
+	public void removeZero() {
+		 int oldArr[]={1,3,4,5,0,0,6,6,0,5,4,7,6,7,0,5};
+		 int retArr[] =  {1,3,4,5,6,6,5,4,7,6,7,5} ;
+		assertArrayEquals(retArr, new ArrayUtil().removeZero(oldArr));
+	}
+
+	@Test
+	public void grow(){
+		int[] array = {2,3,6};
+		
+		int[] retArray = {2,3,6,0,0,0};
+		assertArrayEquals(new ArrayUtil().grow(array, 3),retArray );
+		
+	}
+	
+	@Test
+	public void join(){
+		int[] array = {3,8,9};
+		
+		
+		assertEquals(new ArrayUtil().join(array, "-"), "3-8-9");
+		
+	}
+	
+	@Test
+	public void getPrimes(){
+		// 23, 返回的数组为[2,3,5,7,11,13,17,19]
+		int[] array = {2,3,5,7,11,13,17,19};
+		
+		
+		assertArrayEquals(new ArrayUtil().getPrimes(23), array);
+		
+	}
+	
+	@Test
+	public void getPerfectNumbers(){
+		// 23, 返回的数组为[2,3,5,7,11,13,17,19]
+		int[] array = {1,6};
+		
+		
+		assertArrayEquals(new ArrayUtil().getPerfectNumbers(7), array);
+		
+	}
+	
+	@Test
+	public void fibonacci(){
+		// 23, 返回的数组为[2,3,5,7,11,13,17,19]
+		int[] array =  {1,1,2,3,5,8,13,21};
+		
+		
+		assertArrayEquals(new ArrayUtil().fibonacci(23), array);
+		
+	}
+	
+	
+	
+	
+}
\ No newline at end of file
diff --git a/group16/1325756593/src/com/coderising/litestruts/Action.java b/group16/1325756593/src/com/coderising/litestruts/Action.java
new file mode 100644
index 0000000000..0aef721e3e
--- /dev/null
+++ b/group16/1325756593/src/com/coderising/litestruts/Action.java
@@ -0,0 +1,36 @@
+package com.coderising.litestruts;
+
+import java.util.Map;
+
+public class Action {
+	private String actioName;
+	private String className;
+	private Map<String,String> resultAndViewMap;
+	public String getActioName() {
+		return actioName;
+	}
+	public void setActioName(String actioName) {
+		this.actioName = actioName;
+	}
+	@Override
+	public String toString() {
+		return "Action [actioName=" + actioName + ", className=" + className + ", resultAndViewMap=" + resultAndViewMap
+				+ "]";
+	}
+	public String getClassName() {
+		return className;
+	}
+	public void setClassName(String className) {
+		this.className = className;
+	}
+	public Map<String, String> getResultAndViewMap() {
+		return resultAndViewMap;
+	}
+	public void setResultAndViewMap(Map<String, String> resultAndViewMap) {
+		this.resultAndViewMap = resultAndViewMap;
+	}
+	
+	
+	
+
+}
diff --git a/group16/1325756593/src/com/coderising/litestruts/LoginAction.java b/group16/1325756593/src/com/coderising/litestruts/LoginAction.java
new file mode 100644
index 0000000000..dcdbe226ed
--- /dev/null
+++ b/group16/1325756593/src/com/coderising/litestruts/LoginAction.java
@@ -0,0 +1,39 @@
+package com.coderising.litestruts;
+
+/**
+ * 这是一个用来展示登录的业务类， 其中的用户名和密码都是硬编码的。
+ * @author liuxin
+ *
+ */
+public class LoginAction{
+    private String name ;
+    private String password;
+    private String message;
+
+    public String getName() {
+        return name;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public String execute(){
+            if("test".equals(name) && "1234".equals(password)){
+                this.message = "login successful";
+                return "success";
+            }
+            this.message = "login failed,please check your user/pwd";
+            return "fail";
+    }
+
+    public void setName(String name){
+        this.name = name;
+    }
+    public void setPassword(String password){
+        this.password = password;
+    }
+    public String getMessage(){
+        return this.message;
+    }
+}
diff --git a/group16/1325756593/src/com/coderising/litestruts/Struts.java b/group16/1325756593/src/com/coderising/litestruts/Struts.java
new file mode 100644
index 0000000000..ae6289d5f0
--- /dev/null
+++ b/group16/1325756593/src/com/coderising/litestruts/Struts.java
@@ -0,0 +1,246 @@
+package com.coderising.litestruts;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+
+
+public class Struts {
+	
+	public static String strutsPath;
+	
+
+	public static String getStrutsPath() {
+		return strutsPath;
+	}
+
+	public static void setStrutsPath(String strutsPath) {
+		Struts.strutsPath = strutsPath;
+	}
+
+
+
+
+	public static View runAction(String actionName, Map<String,String> parameters) throws ParserConfigurationException, SAXException, IOException, InstantiationException, IllegalAccessException, ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalArgumentException, InvocationTargetException {
+
+        /*
+         
+		0. 读取配置文件struts.xml
+ 		
+ 		1. 根据actionName找到相对应的class ， 例如LoginAction,   通过反射实例化（创建对象）
+		据parameters中的数据，调用对象的setter方法， 例如parameters中的数据是 
+		("name"="test" ,  "password"="1234") ,     	
+		那就应该调用 setName和setPassword方法
+		
+		2. 通过反射调用对象的exectue 方法， 并获得返回值，例如"success"
+		
+		
+		
+		4. 根据struts.xml中的 <result> 配置,以及execute的返回值，  确定哪一个jsp，  
+		放到View对象的jsp字段中。
+        
+        */
+		if(strutsPath==null||strutsPath.equals("")){
+			strutsPath = initStrutsPath();
+		}
+    	List<Action> actions = parseXml(strutsPath);
+    	Action action = getAction(actions,actionName);  	
+    	NotBeNull(action);  	
+    	
+    	
+    	String actionClassName = action.getClassName();
+    	Class actionClass =  Class.forName(actionClassName);
+    	Object actionClassObject  = actionClass.newInstance();
+
+    	doSetterMethod(parameters, actionClass, actionClassObject);
+    	
+    	Method excuteMethod = actionClass.getMethod("execute", null);
+    	String result = excuteMethod.invoke(actionClassObject, null).toString();
+    	String viewPath = action.getResultAndViewMap().get(result);
+    	View view = new View();
+    	view.setJsp(viewPath);
+    	Map<String, Object> parametersMap = doGetterMethod(actionClass, actionClassObject);
+    	view.setParameters(parametersMap);
+    
+    	return view;
+    }
+
+	
+	/**
+	 * 3. 通过反射找到对象的所有getter方法（例如 getMessage）,  
+		通过反射来调用， 把值和属性形成一个HashMap , 例如 {"message":  "登录成功"} ,  
+		放到View对象的parameters
+	 * @param actionClass
+	 * @param actionClassObject
+	 * @return
+	 * @throws IllegalAccessException
+	 * @throws InvocationTargetException
+	 */
+	private static Map<String, Object> doGetterMethod(Class actionClass, Object actionClassObject)
+			throws IllegalAccessException, InvocationTargetException {
+		Map<String,Object> parametersMap = new HashMap<>();
+    	for(Method method :actionClass.getMethods()){
+    		if(method.getName().startsWith("get")){
+    			String getValue =   getMethodValue(method.getName());
+    			parametersMap.put(getValue, method.invoke(actionClassObject, null));
+    		}    		
+    	}
+		return parametersMap;
+	}
+
+	/**
+	 * 1. 根据actionName找到相对应的class ， 例如LoginAction,   通过反射实例化（创建对象）
+		据parameters中的数据，调用对象的setter方法， 例如parameters中的数据是 
+		("name"="test" ,  "password"="1234") ,     	
+		那就应该调用 setName和setPassword方法
+	 * @param parameters
+	 * @param actionClass
+	 * @param actionClassObject
+	 * @throws NoSuchMethodException
+	 * @throws IllegalAccessException
+	 * @throws InvocationTargetException
+	 */
+	private static void doSetterMethod(Map<String, String> parameters, Class actionClass, Object actionClassObject)
+			throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+		for( Map.Entry<String, String> entry: parameters.entrySet()){
+    		String param = entry.getKey();
+    		Method methodKeySet = actionClass.getMethod(getMethodSet(param), String.class);
+    		methodKeySet.invoke(actionClassObject, entry.getValue());		
+    	}
+	}
+
+	/**
+	 * 初始化strutsPath
+	 * @return
+	 */
+	private static String initStrutsPath() {
+		String path = Struts.class.getClassLoader().getResource("").getPath();
+    	String strutsXmlPath = path+"/com/coderising/litestruts/struts.xml";
+		return strutsXmlPath;
+	}   
+    
+
+	/**
+	 * 通过name构造setName
+	 * @param name
+	 * @return
+	 */
+	public static String getMethodSet(String name){
+	   String firstChar = name.substring(0, 1).toUpperCase();
+	   return "set"+firstChar+name.substring(1);
+	}
+	
+	/**
+	 * 获取getMessage对应的message
+	 * @param name
+	 * @return
+	 */
+	public static String getMethodValue(String name){
+		if(name.length()>=3){
+			name = name.substring(3);
+		}
+		 String firstChar = name.substring(0, 1).toLowerCase();
+		  return firstChar+name.substring(1);
+		}
+	
+   
+    
+    /**
+     * 将xml解析成为Action的List结构
+     * @param xmlPath
+     * @return
+     * @throws ParserConfigurationException
+     * @throws SAXException
+     * @throws IOException
+     */
+    public static List<Action> parseXml(String xmlPath) throws ParserConfigurationException, SAXException, IOException{
+    	List<Action> retActionList = new ArrayList<>();
+    	File xmlFile = new File(xmlPath);
+    	DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+    	DocumentBuilder builder = factory.newDocumentBuilder();
+    	Document doc = builder.parse(xmlFile);
+    	NodeList actionLists = doc.getElementsByTagName("action");
+    	for(int i=0;i<actionLists.getLength();i++){
+    		Node currentNode= actionLists.item(i);
+    		Action action = new Action();
+    		
+    		String actionName = getAttribute(currentNode,"name");
+    		String actionClass = getAttribute(currentNode,"class");
+    		action.setActioName(actionName);
+    		action.setClassName(actionClass);
+    		HashMap<String, String> resultAndViewMap=getResultAndViewNodeList(currentNode);
+    		action.setResultAndViewMap(resultAndViewMap);
+    		retActionList.add(action);
+    	}
+    	return retActionList;
+    }
+
+    /**
+     * 获取该Node对应的result和对应的jsppath
+     * @param currentNode
+     * @param resultAndViewMap
+     */
+	private static HashMap<String, String> getResultAndViewNodeList(Node currentNode) {
+		Map<String, String> resultAndViewMap = new HashMap<>();
+		NodeList resultAndViewNodeList =   currentNode.getChildNodes();
+		
+		for(int j=0;j<resultAndViewNodeList.getLength();j++){
+			Node resultAndViewNode= resultAndViewNodeList.item(j);
+			if("result".equals(resultAndViewNode.getNodeName())){
+				String result = getAttribute(resultAndViewNode,"name");
+				String viewPath = resultAndViewNode.getTextContent();
+				NotBeNull(result);
+				NotBeNull(viewPath);
+				resultAndViewMap.put(result, viewPath);   	
+			}    					
+		}
+		return (HashMap<String, String>) resultAndViewMap;
+	}
+
+	
+	private static void NotBeNull(Object result) {
+		if(result==null){
+			throw new IllegalArgumentException();
+		}
+	}
+	
+
+    
+    public static String getAttribute(Node node ,String name){
+    	NamedNodeMap nameNodeMap = node.getAttributes();
+    	NotBeNull(nameNodeMap);
+    	Node nameNode = nameNodeMap.getNamedItem(name);
+    	NotBeNull(nameNode);
+		String actionName =nameNode.getNodeValue();
+		return actionName;
+    }
+    
+    public static Action getAction(List<Action> actions ,String actionName){
+    	for(Action action:actions){
+    		if(action.getActioName().equals(actionName)){
+    			return action;
+    		}
+    	}
+		return null;
+    	
+    }
+    
+    
+
+}
diff --git a/group16/1325756593/src/com/coderising/litestruts/StrutsTest.java b/group16/1325756593/src/com/coderising/litestruts/StrutsTest.java
new file mode 100644
index 0000000000..487f05542c
--- /dev/null
+++ b/group16/1325756593/src/com/coderising/litestruts/StrutsTest.java
@@ -0,0 +1,48 @@
+package com.coderising.litestruts;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.xml.sax.SAXException;
+
+
+
+
+
+public class StrutsTest {
+
+	@Test
+	public void testLoginActionSuccess() throws InstantiationException, IllegalAccessException, ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalArgumentException, InvocationTargetException, ParserConfigurationException, SAXException, IOException {
+		
+		String actionName = "login";
+        
+		Map<String,String> params = new HashMap<String,String>();
+        params.put("name","test");
+        params.put("password","1234");
+        
+        
+        View view  = Struts.runAction(actionName,params);        
+        
+        Assert.assertEquals("/jsp/homepage.jsp", view.getJsp());
+        Assert.assertEquals("login successful", view.getParameters().get("message"));
+	}
+
+	@Test
+	public void testLoginActionFailed() throws InstantiationException, IllegalAccessException, ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalArgumentException, InvocationTargetException, ParserConfigurationException, SAXException, IOException {
+		String actionName = "login";
+		Map<String,String> params = new HashMap<String,String>();
+        params.put("name","test");
+        params.put("password","123456"); //密码和预设的不一致
+        
+        View view  = Struts.runAction(actionName,params);        
+        
+        Assert.assertEquals("/jsp/showLogin.jsp", view.getJsp());
+        Assert.assertEquals("login failed,please check your user/pwd", view.getParameters().get("message"));
+	}
+}
diff --git a/group16/1325756593/src/com/coderising/litestruts/View.java b/group16/1325756593/src/com/coderising/litestruts/View.java
new file mode 100644
index 0000000000..07df2a5dab
--- /dev/null
+++ b/group16/1325756593/src/com/coderising/litestruts/View.java
@@ -0,0 +1,23 @@
+package com.coderising.litestruts;
+
+import java.util.Map;
+
+public class View {
+	private String jsp;
+	private Map parameters;
+	
+	public String getJsp() {
+		return jsp;
+	}
+	public View setJsp(String jsp) {
+		this.jsp = jsp;
+		return this;
+	}
+	public Map getParameters() {
+		return parameters;
+	}
+	public View setParameters(Map parameters) {
+		this.parameters = parameters;
+		return this;
+	}
+}
diff --git a/group16/1325756593/src/com/coderising/litestruts/struts.xml b/group16/1325756593/src/com/coderising/litestruts/struts.xml
new file mode 100644
index 0000000000..07f80b6476
--- /dev/null
+++ b/group16/1325756593/src/com/coderising/litestruts/struts.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<struts>
+    <action name="login" class="com.coderising.litestruts.LoginAction">
+        <result name="success">/jsp/homepage.jsp</result>
+        <result name="fail">/jsp/showLogin.jsp</result>
+    </action>
+    <action name="logout" class="com.coderising.litestruts.LogoutAction">
+    	<result name= "success">/jsp/welcome.jsp</result>
+    	<result name= "error">/jsp/error.jsp</result>
+    </action>
+</struts>
\ No newline at end of file

From 45e4f370c9ad1f4da10ef0721c7c30ecc86bebf2 Mon Sep 17 00:00:00 2001
From: shane <baohua.shan@zhulebei.com>
Date: Sat, 4 Mar 2017 12:00:37 +0800
Subject: [PATCH 32/36] add ArrayUtil and test

---
 .../study/coderising/array/ArrayUtil.java     | 154 ++++++++++++++----
 .../java/study/coding/basic/ArrayList.java    |  31 ++--
 .../java/study/coding/basic/LinkedList.java   |   7 +-
 .../main/java/study/coding/basic/List.java    |  11 +-
 .../java/study/coderising/ArrayUtilTest.java  |  69 ++++++++
 5 files changed, 221 insertions(+), 51 deletions(-)

diff --git a/group16/214074094/src/main/java/study/coderising/array/ArrayUtil.java b/group16/214074094/src/main/java/study/coderising/array/ArrayUtil.java
index 01061195b2..0ccabbbcaa 100644
--- a/group16/214074094/src/main/java/study/coderising/array/ArrayUtil.java
+++ b/group16/214074094/src/main/java/study/coderising/array/ArrayUtil.java
@@ -1,6 +1,12 @@
 package study.coderising.array;
 
-import com.alibaba.fastjson.JSON;
+
+import study.coding.basic.ArrayList;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
 
 public class ArrayUtil {
 
@@ -12,8 +18,8 @@ public class ArrayUtil {
      * @param origin
      * @return
      */
-    public void reverseArray(int[] origin) {
-        int tmp = 0;
+    public static void reverseArray(int[] origin) {
+        int tmp;
         int len = origin.length;
         int middle = len / 2;
         for (int i = 0; i < middle; i++) {
@@ -23,17 +29,6 @@ public void reverseArray(int[] origin) {
         }
     }
 
-
-
-    public static void main(String[] args) {
-        ArrayUtil util = new ArrayUtil();
-
-        int[] a = {7, 9 , 30, 3};
-        System.out.println(JSON.toJSONString(a));
-        util.reverseArray(a);
-        System.out.println(JSON.toJSONString(a));
-    }
-
     /**
      * 现在有如下的一个数组：   int oldArr[]={1,3,4,5,0,0,6,6,0,5,4,7,6,7,0,5}
      * 要求将以上数组中值为0的项去掉，将不为0的值存入一个新的数组，生成的新数组为：
@@ -43,21 +38,45 @@ public static void main(String[] args) {
      * @return
      */
 
-    public int[] removeZero(int[] oldArray) {
-        return null;
+    public static int[] removeZero(int[] oldArray) {
+        int[] newArray = new int[oldArray.length];
+        int k = 0;
+        for (int i = 0; i < oldArray.length; i++) {
+            if (0 != oldArray[i]) {
+                newArray[k++] = oldArray[i];
+            }
+        }
+        return Arrays.copyOf(newArray, k);
     }
 
     /**
-     * 给定两个已经排序好的整形数组， a1和a2 ,  创建一个新的数组a3, 使得a3 包含a1和a2 的所有元素， 并且仍然是有序的
-     * 例如 a1 = [3, 5, 7,8]   a2 = [4, 5, 6,7]    则 a3 为[3,4,5,6,7,8]    , 注意： 已经消除了重复
+     * 给定两个已经排序好的整形数组，a1和a2，创建一个新的数组a3，使得a3包含a1和a2的所有元素，并且仍然是有序的
+     * 例如 a1 = {3, 5, 7, 8}，a2 = {4, 5, 6, 7}，则 a3 为[3,4,5,6,7,8]，注意：已经消除了重复
      *
-     * @param array1
-     * @param array2
+     * @param a1
+     * @param a2
      * @return
      */
 
-    public int[] merge(int[] array1, int[] array2) {
-        return null;
+    public static int[] merge(int[] a1, int[] a2) {
+        Set set = new HashSet();
+
+        for (int i = 0; i < a1.length + a2.length; i++) {
+            if (i < a1.length) {
+                set.add(a1[i]);
+            } else {
+                set.add(a2[i - a1.length]);
+            }
+        }
+
+        int[] a3 = new int[set.size()];
+
+        Iterator it = set.iterator();
+        int i = 0;
+        while (it.hasNext()) {
+            a3[i++] = (Integer) it.next();
+        }
+        return a3;
     }
 
     /**
@@ -70,8 +89,8 @@ public int[] merge(int[] array1, int[] array2) {
      * @param size
      * @return
      */
-    public int[] grow(int[] oldArray, int size) {
-        return null;
+    public static int[] grow(int[] oldArray, int size) {
+        return Arrays.copyOf(oldArray, oldArray.length + size);
     }
 
     /**
@@ -82,8 +101,22 @@ public int[] grow(int[] oldArray, int size) {
      * @param max
      * @return
      */
-    public int[] fibonacci(int max) {
-        return null;
+    public static int[] fibonacci(int max) {
+        if (max == 1) {
+            return new int[0];
+        }
+        ArrayList<Integer> list = new ArrayList<Integer>();
+        list.add(1);
+        list.add(1);
+        for (int i = 0; ; i++) {
+            int tmp = list.get(i) + list.get(i + 1);
+            if (tmp >= max) {
+                break;
+            }
+            list.add(i + 2, tmp);
+        }
+
+        return convertIntegerArray2Int(list);
     }
 
     /**
@@ -93,8 +126,17 @@ public int[] fibonacci(int max) {
      * @param max
      * @return
      */
-    public int[] getPrimes(int max) {
-        return null;
+    public static int[] getPrimes(int max) {
+        if (max < 2) {
+            return null;
+        }
+        ArrayList<Integer> list = new ArrayList<>();
+        for (int i = 2; i < max; i++) {
+            if (isPrime(i)) {
+                list.add(i);
+            }
+        }
+        return convertIntegerArray2Int(list);
     }
 
     /**
@@ -104,8 +146,29 @@ public int[] getPrimes(int max) {
      * @param max
      * @return
      */
-    public int[] getPerfectNumbers(int max) {
-        return null;
+    public static int[] getPerfectNumbers(int max) {
+        if (max < 2) {
+            return null;
+        }
+        ArrayList<Integer> list = new ArrayList<>();
+
+        int count = 0;
+        //如果p是质数，且2^p-1也是质数，那么（2^p-1）X2^（p-1）便是一个完全数
+        for (int i = 2; i <= max / 2; i++) {
+            count++;
+            if (isPrime(i) && isPrime((int) Math.pow(2, i) - 1)) {
+                System.out.println("count " + i + ":" + (int) (Math.pow(2, i) - 1) + " * " + (int) Math.pow(2, (i - 1)));
+                int perfectNum = (int) ((Math.pow(2, i) - 1) * Math.pow(2, (i - 1)));
+                if(perfectNum > max){
+                    break;
+                }
+                if (perfectNum < max) {
+                    list.add(perfectNum);
+                }
+            }
+        }
+        System.out.println("total count : "+count);
+        return convertIntegerArray2Int(list);
     }
 
     /**
@@ -117,8 +180,35 @@ public int[] getPerfectNumbers(int max) {
      * @param seperator
      * @return
      */
-    public String join(int[] array, String seperator) {
-        return null;
+    public static String join(int[] array, String seperator) {
+        if(null == array || array.length < 1){
+            return null;
+        }
+        StringBuffer sb = new StringBuffer();
+        for (int i = 0; i < array.length; i++) {
+            sb.append(array[i]).append(seperator);
+        }
+        return sb.substring(0, sb.length() - 1);
+    }
+
+    private static boolean isPrime(int n) {
+        if (n == 2) {
+            return true;
+        }
+        for (int j = 2; j <= Math.sqrt(n); j++) {
+            if (n % j == 0) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    private static int[] convertIntegerArray2Int(ArrayList<Integer> list) {
+        int[] arr = new int[list.size()];
+        for (int i = 0; i < list.size(); i++) {
+            arr[i] = list.get(i).intValue();
+        }
+        return arr;
     }
 
 
diff --git a/group16/214074094/src/main/java/study/coding/basic/ArrayList.java b/group16/214074094/src/main/java/study/coding/basic/ArrayList.java
index 8b50b8ed2e..ebe04dd177 100644
--- a/group16/214074094/src/main/java/study/coding/basic/ArrayList.java
+++ b/group16/214074094/src/main/java/study/coding/basic/ArrayList.java
@@ -10,7 +10,7 @@
  * @Email stevenchenguang@gmail.com
  * @Desc OwnArrayList
  */
-public class ArrayList implements List {
+public class ArrayList<E> implements List<E> {
 
     private int size = 0;
 
@@ -28,22 +28,22 @@ public ArrayList() {
     }
 
     @Override
-    public void add(Object o) {
+    public void add(E e) {
         if (elementData == EMPTY_ELEMENTDATA) {
             elementData = Arrays.copyOf(elementData, DEFAULT_CAPACITY);
-            elementData[0] = o;
+            elementData[0] = e;
         } else if (size < elementData.length) {
-            elementData[size] = o;
+            elementData[size] = e;
         } else {
             _grow();
-            elementData[size] = o;
+            elementData[size] = e;
         }
         size++;
         _analyze();
     }
 
     @Override
-    public void add(int index, Object o) {
+    public void add(int index, E e) {
         if (index < 0) {
             throw new IndexOutOfBoundsException("Index:" + index + ", Size:" + size);
         }
@@ -52,40 +52,40 @@ public void add(int index, Object o) {
                 throw new IndexOutOfBoundsException("Index:" + index + ", Size:" + size);
             } else {
                 elementData = new Object[DEFAULT_CAPACITY];
-                elementData[0] = o;
+                elementData[0] = e;
             }
         } else if (index > size) {
             throw new IndexOutOfBoundsException("Index:" + index + ", Size:" + size);
         } else if (index == size) {
             _grow();
-            elementData[size] = o;
+            elementData[size] = e;
             size++;
         } else {
             if (elementData.length == size) {
                 _grow();
             }
             System.arraycopy(elementData, index, elementData, index + 1, size - index);
-            elementData[index] = o;
+            elementData[index] = e;
             size++;
         }
         _analyze();
     }
 
     @Override
-    public Object get(int index) {
+    public E get(int index) {
         if (index < 0 || index >= size) {
             throw new IndexOutOfBoundsException("Index:" + index + ", Size:" + size);
         }
-        return elementData[index];
+        return (E) elementData[index];
     }
 
     @Override
-    public Object remove(int index) {
+    public E remove(int index) {
 
         if (index < 0 || index >= size) {
             throw new IndexOutOfBoundsException("Index:" + index + ", Size:" + size);
         }
-        Object oldValue = elementData[index];
+        E oldValue = (E) elementData[index];
         //需要复制的长度
         int needMoveLength = size - index - 1;
         //如果该长度小于0,　说明只有一个元素,　直接置空即可
@@ -102,6 +102,11 @@ public int size() {
         return size;
     }
 
+    @Override
+    public E[] toArray() {
+        return (E[]) elementData;
+    }
+
     public Iterator iterator() {
         return new ArrayListItrator();
     }
diff --git a/group16/214074094/src/main/java/study/coding/basic/LinkedList.java b/group16/214074094/src/main/java/study/coding/basic/LinkedList.java
index d9f0a753d2..b6fede6824 100644
--- a/group16/214074094/src/main/java/study/coding/basic/LinkedList.java
+++ b/group16/214074094/src/main/java/study/coding/basic/LinkedList.java
@@ -50,7 +50,7 @@ public Object remove(int index) {
         } else if (index == size - 1) {
             return removeLast();
         }
-        
+
         Node curr = _node(index);
         Object data = curr.data;
         final Node prev = curr.prev;
@@ -121,6 +121,11 @@ public int size() {
         return size;
     }
 
+    @Override
+    public Object[] toArray() {
+        return new Object[0];
+    }
+
     public Iterator iterator() {
         return null;
     }
diff --git a/group16/214074094/src/main/java/study/coding/basic/List.java b/group16/214074094/src/main/java/study/coding/basic/List.java
index 2c09924c45..e62dd86d52 100644
--- a/group16/214074094/src/main/java/study/coding/basic/List.java
+++ b/group16/214074094/src/main/java/study/coding/basic/List.java
@@ -1,15 +1,16 @@
 package study.coding.basic;
 
-public interface List {
+public interface List<E> {
 
-    void add(Object o);
+    void add(E e);
 
-    void add(int index, Object o);
+    void add(int index, E e);
 
-    Object get(int index);
+    E get(int index);
 
-    Object remove(int index);
+    E remove(int index);
 
     int size();
 
+    E[] toArray();
 }
diff --git a/group16/214074094/src/test/java/study/coderising/ArrayUtilTest.java b/group16/214074094/src/test/java/study/coderising/ArrayUtilTest.java
index a0268b13f0..24cdeadb64 100644
--- a/group16/214074094/src/test/java/study/coderising/ArrayUtilTest.java
+++ b/group16/214074094/src/test/java/study/coderising/ArrayUtilTest.java
@@ -1,6 +1,9 @@
 package study.coderising;
 
+import org.junit.Assert;
+import org.junit.Test;
 import study.AbstractTest;
+import study.coderising.array.ArrayUtil;
 
 /**
  * @Author shane
@@ -10,4 +13,70 @@
  */
 public class ArrayUtilTest extends AbstractTest {
 
+    @Test
+    public void testReverseArray(){
+        int[] a = {7, 9 , 30, 3};
+        printJson(a);
+        ArrayUtil.reverseArray(a);
+        printJson(a);
+    }
+
+    @Test
+    public void testremoveZero(){
+        int oldArr[] = {1,3,4,5,0,0,6,6,0,5,4,7,6,7,0,5};
+        int newArr[] = ArrayUtil.removeZero(oldArr);
+        printJson(oldArr);
+        printJson(newArr);
+    }
+
+    @Test
+    public void testMerge(){
+        int[] a1 = {3, 5, 7, 8};
+        int[] a2 = {4, 5, 6, 7};
+
+        int[] a3 = ArrayUtil.merge(a1, a2);
+        printJson(a1);
+        printJson(a2);
+        printJson(a3);
+    }
+
+    @Test
+    public void testGrow(){
+        int[] oldArray = {2,3,6};
+        printJson(oldArray);
+        int[] newArray = ArrayUtil.grow(oldArray, 3);
+        printJson(newArray);
+    }
+
+    @Test
+    public void testFibonacci(){
+        int[] onlyOne = {};
+        int[] before15 = {1, 1, 2, 3, 5, 8, 13};
+        int[] before21 = {1, 1, 2, 3, 5, 8, 13};
+        Assert.assertArrayEquals(onlyOne, ArrayUtil.fibonacci(1));
+        Assert.assertArrayEquals(before15, ArrayUtil.fibonacci(15));
+        Assert.assertArrayEquals(before21, ArrayUtil.fibonacci(21));
+    }
+
+    @Test
+    public void testGetPrimes(){
+        int[] _19 = {2,3,5,7,11,13,17,19};
+        Assert.assertArrayEquals(_19, ArrayUtil.getPrimes(23));
+        int[] _32 = {2,3,5,7,11,13,17,19,23,29,31};
+        Assert.assertArrayEquals(_32, ArrayUtil.getPrimes(32));
+    }
+
+    @Test
+    public void testGetPerfectNumbers(){
+        int[] arr = {6,28,496,8128,33550336};
+        Assert.assertArrayEquals(arr, ArrayUtil.getPerfectNumbers(33550337));
+    }
+
+    @Test
+    public void testJoin(){
+        int[] arr = {3,8,9};
+        String seperator = "-";
+        Assert.assertEquals("3-8-9", ArrayUtil.join(arr, seperator));
+    }
+
 }

From 7533d2e5f001f9077d99967bdf90bb338808562f Mon Sep 17 00:00:00 2001
From: shane <baohua.shan@zhulebei.com>
Date: Sat, 4 Mar 2017 23:51:06 +0800
Subject: [PATCH 33/36] homework commit

---
 .../study/coderising/array/ArrayUtil.java     |   6 +-
 .../coderising/litestruts/LoginAction.java    |  37 +++--
 .../coderising/litestruts/LogoutAction.java   |  39 +++++
 .../study/coderising/litestruts/Struts.java   | 145 +++++++++++++++---
 .../coderising/litestruts/StrutsTest.java     | 116 +++++++++++---
 .../study/coderising/litestruts/View.java     |  38 +++--
 .../coderising/litestruts/bean/Action.java    |  43 ++++++
 .../coderising/litestruts/bean/Result.java    |  30 ++++
 .../study/coderising/litestruts/struts.xml    |  11 --
 .../214074094/src/main/resources/struts.xml   |  11 ++
 10 files changed, 378 insertions(+), 98 deletions(-)
 create mode 100644 group16/214074094/src/main/java/study/coderising/litestruts/LogoutAction.java
 create mode 100644 group16/214074094/src/main/java/study/coderising/litestruts/bean/Action.java
 create mode 100644 group16/214074094/src/main/java/study/coderising/litestruts/bean/Result.java
 delete mode 100644 group16/214074094/src/main/java/study/coderising/litestruts/struts.xml
 create mode 100644 group16/214074094/src/main/resources/struts.xml

diff --git a/group16/214074094/src/main/java/study/coderising/array/ArrayUtil.java b/group16/214074094/src/main/java/study/coderising/array/ArrayUtil.java
index 0ccabbbcaa..bd55ae3b86 100644
--- a/group16/214074094/src/main/java/study/coderising/array/ArrayUtil.java
+++ b/group16/214074094/src/main/java/study/coderising/array/ArrayUtil.java
@@ -159,7 +159,7 @@ public static int[] getPerfectNumbers(int max) {
             if (isPrime(i) && isPrime((int) Math.pow(2, i) - 1)) {
                 System.out.println("count " + i + ":" + (int) (Math.pow(2, i) - 1) + " * " + (int) Math.pow(2, (i - 1)));
                 int perfectNum = (int) ((Math.pow(2, i) - 1) * Math.pow(2, (i - 1)));
-                if(perfectNum > max){
+                if (perfectNum > max) {
                     break;
                 }
                 if (perfectNum < max) {
@@ -167,7 +167,7 @@ public static int[] getPerfectNumbers(int max) {
                 }
             }
         }
-        System.out.println("total count : "+count);
+        System.out.println("total count : " + count);
         return convertIntegerArray2Int(list);
     }
 
@@ -181,7 +181,7 @@ public static int[] getPerfectNumbers(int max) {
      * @return
      */
     public static String join(int[] array, String seperator) {
-        if(null == array || array.length < 1){
+        if (null == array || array.length < 1) {
             return null;
         }
         StringBuffer sb = new StringBuffer();
diff --git a/group16/214074094/src/main/java/study/coderising/litestruts/LoginAction.java b/group16/214074094/src/main/java/study/coderising/litestruts/LoginAction.java
index 511888c9b3..043df200d8 100644
--- a/group16/214074094/src/main/java/study/coderising/litestruts/LoginAction.java
+++ b/group16/214074094/src/main/java/study/coderising/litestruts/LoginAction.java
@@ -2,38 +2,41 @@
 
 /**
  * 这是一个用来展示登录的业务类， 其中的用户名和密码都是硬编码的。
- * @author liuxin
  *
+ * @author liuxin
  */
-public class LoginAction{
-    private String name ;
+public class LoginAction {
+
+    private String name;
     private String password;
     private String message;
 
+    public String execute() {
+        if ("test".equals(name) && "1234".equals(password)) {
+            this.message = "login successful";
+            return "success";
+        }
+        this.message = "login failed,please check your user/pwd";
+        return "fail";
+    }
+
     public String getName() {
         return name;
     }
 
-    public String getPassword() {
-        return password;
+    public void setName(String name) {
+        this.name = name;
     }
 
-    public String execute(){
-            if("test".equals(name) && "1234".equals(password)){
-                this.message = "login successful";
-                return "success";
-            }
-            this.message = "login failed,please check your user/pwd";
-            return "fail";
+    public String getPassword() {
+        return password;
     }
 
-    public void setName(String name){
-        this.name = name;
-    }
-    public void setPassword(String password){
+    public void setPassword(String password) {
         this.password = password;
     }
-    public String getMessage(){
+
+    public String getMessage() {
         return this.message;
     }
 }
diff --git a/group16/214074094/src/main/java/study/coderising/litestruts/LogoutAction.java b/group16/214074094/src/main/java/study/coderising/litestruts/LogoutAction.java
new file mode 100644
index 0000000000..e3a10a6726
--- /dev/null
+++ b/group16/214074094/src/main/java/study/coderising/litestruts/LogoutAction.java
@@ -0,0 +1,39 @@
+package study.coderising.litestruts;
+
+/**
+ * @Author shane
+ * @Time 2017/3/4 12:13
+ * @Email stevenchenguang@gmail.com
+ * @Desc ...
+ */
+public class LogoutAction {
+
+    private String name;
+
+    private String message;
+
+    public String execute() {
+        if ("test".equalsIgnoreCase(name)) {
+            message = name + " logout success";
+            return "success";
+        }
+        message = name + " logout fail";
+        return "error";
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+}
diff --git a/group16/214074094/src/main/java/study/coderising/litestruts/Struts.java b/group16/214074094/src/main/java/study/coderising/litestruts/Struts.java
index 90de3c1a43..29ccec1496 100644
--- a/group16/214074094/src/main/java/study/coderising/litestruts/Struts.java
+++ b/group16/214074094/src/main/java/study/coderising/litestruts/Struts.java
@@ -1,34 +1,129 @@
 package study.coderising.litestruts;
 
-import java.util.Map;
+import org.dom4j.Attribute;
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.Element;
+import org.dom4j.io.SAXReader;
+import study.coderising.litestruts.bean.Action;
+import study.coderising.litestruts.bean.Result;
 
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.*;
 
 
 public class Struts {
 
-    public static View runAction(String actionName, Map<String,String> parameters) {
-
-        /*
-         
-		0. 读取配置文件struts.xml
- 		
- 		1. 根据actionName找到相对应的class ， 例如LoginAction,   通过反射实例化（创建对象）
-		据parameters中的数据，调用对象的setter方法， 例如parameters中的数据是 
-		("name"="test" ,  "password"="1234") ,     	
-		那就应该调用 setName和setPassword方法
-		
-		2. 通过反射调用对象的exectue 方法， 并获得返回值，例如"success"
-		
-		3. 通过反射找到对象的所有getter方法（例如 getMessage）,  
-		通过反射来调用， 把值和属性形成一个HashMap , 例如 {"message":  "登录成功"} ,  
-		放到View对象的parameters
-		
-		4. 根据struts.xml中的 <result> 配置,以及execute的返回值，  确定哪一个jsp，  
-		放到View对象的jsp字段中。
-        
-        */
-    	
-    	return null;
-    }    
+    private static final String EXECUTE = "execute";
+
+    public static View runAction(String actionName, Map<String, String> parameters)
+            throws DocumentException, ClassNotFoundException, NoSuchMethodException,
+            InvocationTargetException, IllegalAccessException, InstantiationException {
+
+        //0. 读取配置文件struts.xml
+        SAXReader reader = new SAXReader();
+        Document doc = reader.read("./src/main/resources/struts.xml");
+        Element root = doc.getRootElement();
+        Action action = getAction(actionName, root);
+
+        //1. 根据actionName找到相对应的class
+        Class clz = Class.forName(action.getClassPath());
+
+        Object obj = clz.newInstance();
+
+        //1.1 据parameters中的数据，调用对象的setter方法
+        for (Map.Entry<String, String> entry : parameters.entrySet()) {
+            String setFunctionName = getFunctionName("set", entry.getKey());
+            Method set = clz.getDeclaredMethod(setFunctionName, String.class);
+            set.invoke(obj, entry.getValue());
+        }
+
+        //2. 通过反射调用对象的exectue 方法， 并获得返回值，例如"success"
+        Method execute = clz.getDeclaredMethod(EXECUTE);
+        String response = execute.invoke(obj).toString();
+
+        //3. 通过反射找到对象的所有getter方法并调用， 把值和属性形成一个HashMap
+        Method[] methods = clz.getDeclaredMethods();
+        Map<String, Object> map = new HashMap<>();
+        for (Method m : methods) {
+            if (m.getName().startsWith("get")) {
+                String paramName = m.getName().replaceFirst("get", "");
+                map.put(paramName.toLowerCase(), m.invoke(obj));
+            }
+        }
+
+        //3.1 放到View对象的parameters
+        View view = new View();
+        view.setParameters(map);
+
+        //4. 根据struts.xml中的配置,以及execute的返回值，确定jsp，放到View对象的jsp字段中。
+        for (Result result : action.getResults()) {
+            if (response.equalsIgnoreCase(result.getResult())) {
+                view.setJsp(result.getJumpPath());
+                break;
+            }
+        }
+
+        return view;
+    }
+
+    private static String getFunctionName(String head, String key) {
+        if (key == null || "".equals(key)) {
+            return null;
+        }
+        StringBuffer sb = new StringBuffer(head);
+        if (key.length() < 2) {
+            sb.append(key.toUpperCase());
+        } else {
+            String first = String.valueOf(key.charAt(0));
+            sb.append(first.toUpperCase());
+            sb.append(key.substring(1, key.length()));
+        }
+        return sb.toString();
+    }
+
+    private static Action getAction(String actionName, Element node) {
+        Action action = new Action();
+
+        Iterator<Element> iterator = node.elementIterator();
+        boolean flag = false;
+        while (iterator.hasNext()) {
+            Element e = iterator.next();
+            List<Attribute> list = e.attributes();
+
+            //遍历属性节点
+            for (Attribute attr : list) {
+
+                if ("name".equalsIgnoreCase(attr.getName())) {
+                    if (!actionName.equalsIgnoreCase(attr.getValue())) {
+                        continue;
+                    } else {
+                        flag = true;
+                    }
+                    action.setName(attr.getValue());
+                }
+                if ("class".equalsIgnoreCase(attr.getName())) {
+                    action.setClassPath(attr.getValue());
+                }
+
+                List<Result> results = new ArrayList<>();
+
+                Iterator<Element> it = e.elementIterator();
+                while (it.hasNext()) {
+                    Result result = new Result();
+                    Element el = it.next();
+                    result.setResult(el.attribute(0).getValue());
+                    result.setJumpPath(el.getText());
+                    results.add(result);
+                }
+                action.setResults(results);
+            }
+            if (flag) {
+                break;
+            }
+        }
+        return action;
+    }
 
 }
diff --git a/group16/214074094/src/main/java/study/coderising/litestruts/StrutsTest.java b/group16/214074094/src/main/java/study/coderising/litestruts/StrutsTest.java
index 90dbf21689..db1b37de1b 100644
--- a/group16/214074094/src/main/java/study/coderising/litestruts/StrutsTest.java
+++ b/group16/214074094/src/main/java/study/coderising/litestruts/StrutsTest.java
@@ -3,41 +3,107 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import org.dom4j.DocumentException;
 import org.junit.Assert;
 import org.junit.Test;
 
+public class StrutsTest {
 
+    @Test
+    public void testLoginActionSuccess() {
 
+        String actionName = "login";
 
+        Map<String, String> params = new HashMap<String, String>();
+        params.put("name", "test");
+        params.put("password", "1234");
 
-public class StrutsTest {
+        View view = null;
+        try {
+            view = Struts.runAction(actionName, params);
+        } catch (DocumentException e) {
+            e.printStackTrace();
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        } catch (NoSuchMethodException e) {
+            e.printStackTrace();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
 
-	@Test
-	public void testLoginActionSuccess() {
-		
-		String actionName = "login";
-        
-		Map<String,String> params = new HashMap<String,String>();
-        params.put("name","test");
-        params.put("password","1234");
-        
-        
-        View view  = Struts.runAction(actionName,params);        
-        
         Assert.assertEquals("/jsp/homepage.jsp", view.getJsp());
         Assert.assertEquals("login successful", view.getParameters().get("message"));
-	}
-
-	@Test
-	public void testLoginActionFailed() {
-		String actionName = "login";
-		Map<String,String> params = new HashMap<String,String>();
-        params.put("name","test");
-        params.put("password","123456"); //密码和预设的不一致
-        
-        View view  = Struts.runAction(actionName,params);        
-        
+    }
+
+    @Test
+    public void testLoginActionFailed() {
+        String actionName = "login";
+        Map<String, String> params = new HashMap<String, String>();
+        params.put("name", "test");
+        params.put("password", "123456"); //密码和预设的不一致
+
+        View view = null;
+        try {
+            view = Struts.runAction(actionName, params);
+        } catch (DocumentException e) {
+            e.printStackTrace();
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        } catch (NoSuchMethodException e) {
+            e.printStackTrace();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
         Assert.assertEquals("/jsp/showLogin.jsp", view.getJsp());
         Assert.assertEquals("login failed,please check your user/pwd", view.getParameters().get("message"));
-	}
+    }
+
+    @Test
+    public void testLogoutSuccess() {
+        String actionName = "logout";
+
+        Map<String, String> params = new HashMap<String, String>();
+        params.put("name", "test");
+
+        View view = null;
+        try {
+            view = Struts.runAction(actionName, params);
+        } catch (DocumentException e) {
+            e.printStackTrace();
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        } catch (NoSuchMethodException e) {
+            e.printStackTrace();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        Assert.assertEquals("/jsp/welcome.jsp", view.getJsp());
+        Assert.assertEquals("test logout success", view.getParameters().get("message"));
+    }
+
+    @Test
+    public void testLogoutFail() {
+        String actionName = "logout";
+
+        Map<String, String> params = new HashMap<String, String>();
+        params.put("name", "unknownUser");
+
+        View view = null;
+        try {
+            view = Struts.runAction(actionName, params);
+        } catch (DocumentException e) {
+            e.printStackTrace();
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        } catch (NoSuchMethodException e) {
+            e.printStackTrace();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        Assert.assertEquals("/jsp/error.jsp", view.getJsp());
+        Assert.assertEquals("unknownUser logout fail", view.getParameters().get("message"));
+    }
 }
diff --git a/group16/214074094/src/main/java/study/coderising/litestruts/View.java b/group16/214074094/src/main/java/study/coderising/litestruts/View.java
index 90b66b19dd..af3df5b9e9 100644
--- a/group16/214074094/src/main/java/study/coderising/litestruts/View.java
+++ b/group16/214074094/src/main/java/study/coderising/litestruts/View.java
@@ -3,21 +3,25 @@
 import java.util.Map;
 
 public class View {
-	private String jsp;
-	private Map parameters;
-	
-	public String getJsp() {
-		return jsp;
-	}
-	public View setJsp(String jsp) {
-		this.jsp = jsp;
-		return this;
-	}
-	public Map getParameters() {
-		return parameters;
-	}
-	public View setParameters(Map parameters) {
-		this.parameters = parameters;
-		return this;
-	}
+
+    private String jsp;
+    private Map parameters;
+
+    public String getJsp() {
+        return jsp;
+    }
+
+    public View setJsp(String jsp) {
+        this.jsp = jsp;
+        return this;
+    }
+
+    public Map getParameters() {
+        return parameters;
+    }
+
+    public View setParameters(Map parameters) {
+        this.parameters = parameters;
+        return this;
+    }
 }
diff --git a/group16/214074094/src/main/java/study/coderising/litestruts/bean/Action.java b/group16/214074094/src/main/java/study/coderising/litestruts/bean/Action.java
new file mode 100644
index 0000000000..12aa461cfc
--- /dev/null
+++ b/group16/214074094/src/main/java/study/coderising/litestruts/bean/Action.java
@@ -0,0 +1,43 @@
+package study.coderising.litestruts.bean;
+
+
+import java.util.List;
+
+/**
+ * @Author shane
+ * @Time 2017/3/4 21:49
+ * @Email shanbaohua@lxfintech.com
+ * @Desc ...
+ */
+public class Action {
+
+    private String name;
+
+    private String classPath;
+
+    private List<Result> results;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getClassPath() {
+        return classPath;
+    }
+
+    public void setClassPath(String classPath) {
+        this.classPath = classPath;
+    }
+
+    public List<Result> getResults() {
+        return results;
+    }
+
+    public void setResults(List<Result> results) {
+        this.results = results;
+    }
+}
diff --git a/group16/214074094/src/main/java/study/coderising/litestruts/bean/Result.java b/group16/214074094/src/main/java/study/coderising/litestruts/bean/Result.java
new file mode 100644
index 0000000000..649844ff31
--- /dev/null
+++ b/group16/214074094/src/main/java/study/coderising/litestruts/bean/Result.java
@@ -0,0 +1,30 @@
+package study.coderising.litestruts.bean;
+
+/**
+ * @Author shane
+ * @Time 2017/3/4 21:50
+ * @Email shanbaohua@lxfintech.com
+ * @Desc ...
+ */
+public class Result {
+
+    private String result;
+
+    private String jumpPath;
+
+    public String getResult() {
+        return result;
+    }
+
+    public void setResult(String result) {
+        this.result = result;
+    }
+
+    public String getJumpPath() {
+        return jumpPath;
+    }
+
+    public void setJumpPath(String jumpPath) {
+        this.jumpPath = jumpPath;
+    }
+}
diff --git a/group16/214074094/src/main/java/study/coderising/litestruts/struts.xml b/group16/214074094/src/main/java/study/coderising/litestruts/struts.xml
deleted file mode 100644
index 99063bcb0c..0000000000
--- a/group16/214074094/src/main/java/study/coderising/litestruts/struts.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<struts>
-    <action name="login" class="com.coderising.action.LoginAction">
-        <result name="success">/jsp/homepage.jsp</result>
-        <result name="fail">/jsp/showLogin.jsp</result>
-    </action>
-    <action name="logout" class="com.coderising.action.LogoutAction">
-    	<result = "success">/jsp/welcome.jsp</result>
-    	<result = "error">/jsp/error.jsp</result>
-    </action>
-</struts>
\ No newline at end of file
diff --git a/group16/214074094/src/main/resources/struts.xml b/group16/214074094/src/main/resources/struts.xml
new file mode 100644
index 0000000000..f93213e241
--- /dev/null
+++ b/group16/214074094/src/main/resources/struts.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<struts>
+    <action name="login" class="study.coderising.litestruts.LoginAction">
+        <result result="success">/jsp/homepage.jsp</result>
+        <result result="fail">/jsp/showLogin.jsp</result>
+    </action>
+    <action name="logout" class="study.coderising.litestruts.LogoutAction">
+        <result result="success">/jsp/welcome.jsp</result>
+        <result result="error">/jsp/error.jsp</result>
+    </action>
+</struts>
\ No newline at end of file

From 3b897a0b305889db78d793636ce48e6a3ef54d3c Mon Sep 17 00:00:00 2001
From: shane <baohua.shan@zhulebei.com>
Date: Sat, 4 Mar 2017 23:58:26 +0800
Subject: [PATCH 34/36] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../study/coderising/array/ArrayUtil.java     |  8 ++----
 .../study/coderising/litestruts/Struts.java   | 28 +++++++++++++++----
 2 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/group16/214074094/src/main/java/study/coderising/array/ArrayUtil.java b/group16/214074094/src/main/java/study/coderising/array/ArrayUtil.java
index bd55ae3b86..c2b0c62a79 100644
--- a/group16/214074094/src/main/java/study/coderising/array/ArrayUtil.java
+++ b/group16/214074094/src/main/java/study/coderising/array/ArrayUtil.java
@@ -20,12 +20,10 @@ public class ArrayUtil {
      */
     public static void reverseArray(int[] origin) {
         int tmp;
-        int len = origin.length;
-        int middle = len / 2;
-        for (int i = 0; i < middle; i++) {
+        for (int i = 0; i < origin.length / 2; i++) {
             tmp = origin[i];
-            origin[i] = origin[len - i - 1];
-            origin[len - i - 1] = tmp;
+            origin[i] = origin[origin.length - i - 1];
+            origin[origin.length - i - 1] = tmp;
         }
     }
 
diff --git a/group16/214074094/src/main/java/study/coderising/litestruts/Struts.java b/group16/214074094/src/main/java/study/coderising/litestruts/Struts.java
index 29ccec1496..9a70e7a525 100644
--- a/group16/214074094/src/main/java/study/coderising/litestruts/Struts.java
+++ b/group16/214074094/src/main/java/study/coderising/litestruts/Struts.java
@@ -29,7 +29,7 @@ public static View runAction(String actionName, Map<String, String> parameters)
 
         //1. 根据actionName找到相对应的class
         Class clz = Class.forName(action.getClassPath());
-
+        //获取一个实例,方便接下来对同一个对象赋值
         Object obj = clz.newInstance();
 
         //1.1 据parameters中的数据，调用对象的setter方法
@@ -39,7 +39,7 @@ public static View runAction(String actionName, Map<String, String> parameters)
             set.invoke(obj, entry.getValue());
         }
 
-        //2. 通过反射调用对象的exectue 方法， 并获得返回值，例如"success"
+        //2. 通过反射调用对象的exectue方法， 并获得返回值
         Method execute = clz.getDeclaredMethod(EXECUTE);
         String response = execute.invoke(obj).toString();
 
@@ -68,11 +68,21 @@ public static View runAction(String actionName, Map<String, String> parameters)
         return view;
     }
 
-    private static String getFunctionName(String head, String key) {
+    /**
+     * @Author: shane
+     * @Time: 2017/3/4 23:53
+     * @Email: stevenchenguang@gmail.com
+     * @param: begin, key
+     * @Return: String
+     * @Throw:
+     * @Desc: 根据开始名称和key获取方法名
+     * e.g.: begin: get, key: name, return getName
+     */
+    private static String getFunctionName(String begin, String key) {
         if (key == null || "".equals(key)) {
             return null;
         }
-        StringBuffer sb = new StringBuffer(head);
+        StringBuffer sb = new StringBuffer(begin);
         if (key.length() < 2) {
             sb.append(key.toUpperCase());
         } else {
@@ -83,6 +93,15 @@ private static String getFunctionName(String head, String key) {
         return sb.toString();
     }
 
+    /**
+     * @Author: shane
+     * @Time: 2017/3/4 23:55
+     * @Email: stevenchenguang@gmail.com
+     * @param: actionName, node
+     * @Return: Action
+     * @Throw:
+     * @Desc: 根据actionName和xml节点获取Action
+     */
     private static Action getAction(String actionName, Element node) {
         Action action = new Action();
 
@@ -94,7 +113,6 @@ private static Action getAction(String actionName, Element node) {
 
             //遍历属性节点
             for (Attribute attr : list) {
-
                 if ("name".equalsIgnoreCase(attr.getName())) {
                     if (!actionName.equalsIgnoreCase(attr.getValue())) {
                         continue;

From 0fd8a371804d95eb66956607fdeb92be29a646e1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=AD=E5=B7=9E-=E5=A4=A7=E6=98=8E?= <420355244@qq.com>
Date: Sun, 5 Mar 2017 10:49:20 +0800
Subject: [PATCH 35/36] submit  litestruts

---
 group16/420355244/Homework2/.classpath        |   8 ++
 group16/420355244/Homework2/.gitignore        |   1 +
 group16/420355244/Homework2/.project          |  17 +++
 .../com/coderising/action/LoginAction.java    |  39 +++++
 .../src/com/coderising/array/ArrayUtil.java   | 120 ++++++++++++++++
 .../src/com/coderising/litestruts/Struts.java | 133 ++++++++++++++++++
 .../com/coderising/litestruts/StrutsTest.java |  43 ++++++
 .../src/com/coderising/litestruts/View.java   |  23 +++
 .../src/com/coderising/litestruts/struts.xml  |  11 ++
 9 files changed, 395 insertions(+)
 create mode 100644 group16/420355244/Homework2/.classpath
 create mode 100644 group16/420355244/Homework2/.gitignore
 create mode 100644 group16/420355244/Homework2/.project
 create mode 100644 group16/420355244/Homework2/src/com/coderising/action/LoginAction.java
 create mode 100644 group16/420355244/Homework2/src/com/coderising/array/ArrayUtil.java
 create mode 100644 group16/420355244/Homework2/src/com/coderising/litestruts/Struts.java
 create mode 100644 group16/420355244/Homework2/src/com/coderising/litestruts/StrutsTest.java
 create mode 100644 group16/420355244/Homework2/src/com/coderising/litestruts/View.java
 create mode 100644 group16/420355244/Homework2/src/com/coderising/litestruts/struts.xml

diff --git a/group16/420355244/Homework2/.classpath b/group16/420355244/Homework2/.classpath
new file mode 100644
index 0000000000..f5d4a033ec
--- /dev/null
+++ b/group16/420355244/Homework2/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
+	<classpathentry kind="lib" path="lib/dom4j-1.6.1.jar"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/group16/420355244/Homework2/.gitignore b/group16/420355244/Homework2/.gitignore
new file mode 100644
index 0000000000..ae3c172604
--- /dev/null
+++ b/group16/420355244/Homework2/.gitignore
@@ -0,0 +1 @@
+/bin/
diff --git a/group16/420355244/Homework2/.project b/group16/420355244/Homework2/.project
new file mode 100644
index 0000000000..1a13fc592d
--- /dev/null
+++ b/group16/420355244/Homework2/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>Homework2</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>
diff --git a/group16/420355244/Homework2/src/com/coderising/action/LoginAction.java b/group16/420355244/Homework2/src/com/coderising/action/LoginAction.java
new file mode 100644
index 0000000000..5496d8084d
--- /dev/null
+++ b/group16/420355244/Homework2/src/com/coderising/action/LoginAction.java
@@ -0,0 +1,39 @@
+package com.coderising.action;
+
+/**
+ * 这是一个用来展示登录的业务类， 其中的用户名和密码都是硬编码的。
+ * @author liuxin
+ *
+ */
+public class LoginAction{
+    private String name ;
+    private String password;
+    private String message;
+
+    public String getName() {
+        return name;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public String execute(){
+            if("test".equals(name) && "1234".equals(password)){
+                this.message = "login successful";
+                return "success";
+            }
+            this.message = "login failed,please check your user/pwd";
+            return "fail";
+    }
+
+    public void setName(String name){
+        this.name = name;
+    }
+    public void setPassword(String password){
+        this.password = password;
+    }
+    public String getMessage(){
+        return this.message;
+    }
+}
diff --git a/group16/420355244/Homework2/src/com/coderising/array/ArrayUtil.java b/group16/420355244/Homework2/src/com/coderising/array/ArrayUtil.java
new file mode 100644
index 0000000000..5fd5f1efba
--- /dev/null
+++ b/group16/420355244/Homework2/src/com/coderising/array/ArrayUtil.java
@@ -0,0 +1,120 @@
+package com.coderising.array;
+
+public class ArrayUtil {
+	
+	/**
+	 * 给定一个整形数组a , 对该数组的值进行置换
+		例如： a = [7, 9 , 30, 3]  ,   置换后为 [3, 30, 9,7]
+		如果     a = [7, 9, 30, 3, 4] , 置换后为 [4,3, 30 , 9,7]
+	 * @param origin
+	 * @return
+	 */
+	public static void reverseArray(int[] origin){
+		for(int i = 0;i < origin.length/2; i++){
+			int x = origin[i];
+			origin[i] = origin[origin.length - i -1];
+			origin[origin.length - i -1] = x;
+		}
+	}
+	
+	/**
+	 * 现在有如下的一个数组：   int oldArr[]={1,3,4,5,0,0,6,6,0,5,4,7,6,7,0,5}   
+	 * 要求将以上数组中值为0的项去掉，将不为0的值存入一个新的数组，生成的新数组为：   
+	 * {1,3,4,5,6,6,5,4,7,6,7,5}  
+	 * @param oldArray
+	 * @return
+	 */
+	
+	public static  int[] removeZero(int[] oldArray){
+		for(int i = 0;i < oldArray.length ;i++){
+			if(oldArray[i] == 0){
+				int[] a = {};
+				System.arraycopy(oldArray, 0, a, 0, i);
+				System.arraycopy(oldArray, 0, a, i, oldArray.length);
+				oldArray = a;
+				removeZero(oldArray);
+			}
+		}
+		return oldArray;
+	}
+	
+	/**
+	 * 给定两个已经排序好的整形数组， a1和a2 ,  创建一个新的数组a3, 使得a3 包含a1和a2 的所有元素， 并且仍然是有序的
+	 * 例如 a1 = [3, 5, 7,8]   a2 = [4, 5, 6,7]    则 a3 为[3,4,5,6,7,8]    , 注意： 已经消除了重复
+	 * @param array1
+	 * @param array2
+	 * @return
+	 */
+	
+	public static  int[] merge(int[] array1, int[] array2){
+		return  null;
+	}
+	/**
+	 * 把一个已经存满数据的数组 oldArray的容量进行扩展， 扩展后的新数据大小为oldArray.length + size
+	 * 注意，老数组的元素在新数组中需要保持
+	 * 例如 oldArray = [2,3,6] , size = 3,则返回的新数组为
+	 * [2,3,6,0,0,0]
+	 * @param oldArray
+	 * @param size
+	 * @return
+	 */
+	public static  int[] grow(int [] oldArray,  int size){
+		return null;
+	}
+	
+	/**
+	 * 斐波那契数列为：1，1，2，3，5，8，13，21......  ，给定一个最大值， 返回小于该值的数列
+	 * 例如， max = 15 , 则返回的数组应该为 [1，1，2，3，5，8，13]
+	 * max = 1, 则返回空数组 []
+	 * @param max
+	 * @return
+	 */
+	public static  int[] fibonacci(int max){
+		return null;
+	}
+	
+	/**
+	 * 返回小于给定最大值max的所有素数数组
+	 * 例如max = 23, 返回的数组为[2,3,5,7,11,13,17,19]
+	 * @param max
+	 * @return
+	 */
+	public  static int[] getPrimes(int max){
+		return null;
+	}
+	
+	/**
+	 * 所谓“完数”， 是指这个数恰好等于它的因子之和，例如6=1+2+3
+	 * 给定一个最大值max， 返回一个数组， 数组中是小于max 的所有完数
+	 * @param max
+	 * @return
+	 */
+	public static  int[] getPerfectNumbers(int max){
+		return null;
+	}
+	
+	/**
+	 * 用seperator 把数组 array给连接起来
+	 * 例如array= [3,8,9], seperator = "-"
+	 * 则返回值为"3-8-9"
+	 * @param array
+	 * @param s
+	 * @return
+	 */
+	public static  String join(int[] array, String seperator){
+		return null;
+	}
+	
+	public static void main(String[] args) {
+		/*int[] a = {7, 9 , 30, 3};
+		reverseArray(a);
+		for (int i : a) {
+			System.out.print(i+",");
+		}*/
+		int oldArr[]={1,3,4,5,0,0,6,6,0,5,4,7,6,7,0,5} ;
+		removeZero(oldArr);
+		for (int i : oldArr) {
+			System.out.print(i+",");
+		}
+	}
+}
diff --git a/group16/420355244/Homework2/src/com/coderising/litestruts/Struts.java b/group16/420355244/Homework2/src/com/coderising/litestruts/Struts.java
new file mode 100644
index 0000000000..40af955dfa
--- /dev/null
+++ b/group16/420355244/Homework2/src/com/coderising/litestruts/Struts.java
@@ -0,0 +1,133 @@
+package com.coderising.litestruts;
+
+import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.Element;
+import org.dom4j.io.SAXReader;
+
+
+
+public class Struts {
+
+    public static View runAction(String actionName, Map<String,String> parameters) {
+
+        /*
+         
+		0. 读取配置文件struts.xml
+ 		
+ 		1. 根据actionName找到相对应的class ， 例如LoginAction,   通过反射实例化（创建对象）
+		据parameters中的数据，调用对象的setter方法， 例如parameters中的数据是 
+		("name"="test" ,  "password"="1234") ,     	
+		那就应该调用 setName和setPassword方法
+		
+		2. 通过反射调用对象的exectue 方法， 并获得返回值，例如"success"
+		
+		3. 通过反射找到对象的所有getter方法（例如 getMessage）,  
+		通过反射来调用， 把值和属性形成一个HashMap , 例如 {"message":  "登录成功"} ,  
+		放到View对象的parameters
+		
+		4. 根据struts.xml中的 <result> 配置,以及execute的返回值，  确定哪一个jsp，  
+		放到View对象的jsp字段中。
+        
+        */
+    	//0. 读取配置文件struts.xml
+    	SAXReader reader = new SAXReader();
+    	try {
+    		//0.2 读取文件
+			Document doc = reader.read(new File("./src/com/coderising/litestruts/struts.xml"));
+			//0.3 得到根标签
+			Element rootElement = doc.getRootElement();
+			//0.4 得到根标签下的所有action标签 
+			Iterator<Element> elementIterator = rootElement.elementIterator("action");
+			while(elementIterator.hasNext()){
+				Element element = elementIterator.next();
+				String nameValue = element.attributeValue("name");
+				try {
+					if(null != actionName && actionName.trim() != ""){
+						if(actionName.equals(nameValue)){
+							View view = new View();
+							//进入该action标签内,结束后停止循环
+							String classValue = element.attributeValue("class");
+							//1.1 根据actionName找到相对应的class ， 例如LoginAction,   通过反射实例化（创建对象）据parameters中的数据
+							Class clazz =Class.forName(classValue);
+							Object instance = clazz.newInstance();
+							Method[] methods = clazz.getMethods();
+							for (Entry<String, String> entry :  parameters.entrySet()) {
+								String methodName = "set" + entry.getKey().substring(0, 1).toUpperCase() + entry.getKey().substring(1);
+								//1.2调用对象的setter方法， 例如parameters中的数据是 ("name"="test" ,  "password"="1234") ,那就应该调用 setName和setPassword方法
+								for (Method setterMethod : methods) {
+									if(methodName.equals(setterMethod.getName())){
+										setterMethod.invoke(instance,entry.getValue());
+											break;
+									}
+								}
+							}
+							//2. 通过反射调用对象的exectue 方法， 并获得返回值，例如"success"
+							Method method = clazz.getMethod("execute", null);
+							Object exectueResult = method.invoke(instance, null); 
+							Iterator<Element> resultElement = element.elementIterator("result");
+							while(resultElement.hasNext()){
+								Element result = resultElement.next();
+								if(exectueResult.equals(result.attributeValue("name"))){
+									String jsp = result.getText();
+									view.setJsp(jsp);
+									break;
+								}
+							}
+							/*3. 通过反射找到对象的所有getter方法（例如 getMessage）,  
+								通过反射来调用， 把值和属性形成一个HashMap , 例如 {"message":  "登录成功"} ,  
+								放到View对象的parameters*/
+							HashMap<Object, Object> hashMap = new HashMap<>();
+							for (Method getterMethod : methods) {
+								if(getterMethod.getName().contains("get")){
+									Object resultValue = getterMethod.invoke(instance,null);
+									String resultKey = getterMethod.getName().replace("get", "").substring(0,1).toLowerCase() 
+											+ getterMethod.getName().replace("get", "").substring(1);
+									hashMap.put(resultKey, resultValue);
+								}
+							}
+							view.setParameters(hashMap);
+							return view;
+						}
+					}
+				} catch (ClassNotFoundException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				} catch (InstantiationException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				} catch (IllegalAccessException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				} catch (SecurityException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				} catch (IllegalArgumentException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				} catch (InvocationTargetException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				} catch (NoSuchMethodException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				}
+			}
+		} catch (DocumentException e) {
+			e.printStackTrace();
+		}
+    	return null;
+    }   
+    public static void main(String[] args) {
+    	runAction("login",null);
+	}
+
+}
diff --git a/group16/420355244/Homework2/src/com/coderising/litestruts/StrutsTest.java b/group16/420355244/Homework2/src/com/coderising/litestruts/StrutsTest.java
new file mode 100644
index 0000000000..b8c81faf3c
--- /dev/null
+++ b/group16/420355244/Homework2/src/com/coderising/litestruts/StrutsTest.java
@@ -0,0 +1,43 @@
+package com.coderising.litestruts;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+
+
+
+
+public class StrutsTest {
+
+	@Test
+	public void testLoginActionSuccess() {
+		
+		String actionName = "login";
+        
+		Map<String,String> params = new HashMap<String,String>();
+        params.put("name","test");
+        params.put("password","1234");
+        
+        
+        View view  = Struts.runAction(actionName,params);        
+        
+        Assert.assertEquals("/jsp/homepage.jsp", view.getJsp());
+        Assert.assertEquals("login successful", view.getParameters().get("message"));
+	}
+
+	@Test
+	public void testLoginActionFailed() {
+		String actionName = "login";
+		Map<String,String> params = new HashMap<String,String>();
+        params.put("name","test");
+        params.put("password","123456"); //密码和预设的不一致
+        
+        View view  = Struts.runAction(actionName,params);        
+        
+        Assert.assertEquals("/jsp/showLogin.jsp", view.getJsp());
+        Assert.assertEquals("login failed,please check your user/pwd", view.getParameters().get("message"));
+	}
+}
diff --git a/group16/420355244/Homework2/src/com/coderising/litestruts/View.java b/group16/420355244/Homework2/src/com/coderising/litestruts/View.java
new file mode 100644
index 0000000000..07df2a5dab
--- /dev/null
+++ b/group16/420355244/Homework2/src/com/coderising/litestruts/View.java
@@ -0,0 +1,23 @@
+package com.coderising.litestruts;
+
+import java.util.Map;
+
+public class View {
+	private String jsp;
+	private Map parameters;
+	
+	public String getJsp() {
+		return jsp;
+	}
+	public View setJsp(String jsp) {
+		this.jsp = jsp;
+		return this;
+	}
+	public Map getParameters() {
+		return parameters;
+	}
+	public View setParameters(Map parameters) {
+		this.parameters = parameters;
+		return this;
+	}
+}
diff --git a/group16/420355244/Homework2/src/com/coderising/litestruts/struts.xml b/group16/420355244/Homework2/src/com/coderising/litestruts/struts.xml
new file mode 100644
index 0000000000..dd598a3664
--- /dev/null
+++ b/group16/420355244/Homework2/src/com/coderising/litestruts/struts.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<struts>
+    <action name="login" class="com.coderising.action.LoginAction">
+        <result name="success">/jsp/homepage.jsp</result>
+        <result name="fail">/jsp/showLogin.jsp</result>
+    </action>
+    <action name="logout" class="com.coderising.action.LogoutAction">
+    	<result name="success">/jsp/welcome.jsp</result>
+    	<result name="error">/jsp/error.jsp</result>
+    </action>
+</struts>
\ No newline at end of file

From 6153403f2af6859050a3d0649c9fb9578e908681 Mon Sep 17 00:00:00 2001
From: Li Han <hiliguoxin@foxmail.com>
Date: Sun, 5 Mar 2017 12:50:13 +0800
Subject: [PATCH 36/36] =?UTF-8?q?0305=E4=BD=9C=E4=B8=9A=E6=8F=90=E4=BA=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

完成liteStruts配置文件的读取
---
 group16/502059278/.classpath                  |  1 +
 .../src/cn/mark/work0226/ArrayUtil.java       |  5 +-
 .../mark/work0226/litestruts/LoginAction.java | 39 +++++++++
 .../cn/mark/work0226/litestruts/Struts.java   | 84 +++++++++++++++++++
 .../mark/work0226/litestruts/StrutsTest.java  | 43 ++++++++++
 .../src/cn/mark/work0226/litestruts/View.java | 23 +++++
 .../cn/mark/work0226/litestruts/XMLUtils.java | 49 +++++++++++
 group16/502059278/src/struts.xml              | 11 +++
 8 files changed, 251 insertions(+), 4 deletions(-)
 create mode 100644 group16/502059278/src/cn/mark/work0226/litestruts/LoginAction.java
 create mode 100644 group16/502059278/src/cn/mark/work0226/litestruts/Struts.java
 create mode 100644 group16/502059278/src/cn/mark/work0226/litestruts/StrutsTest.java
 create mode 100644 group16/502059278/src/cn/mark/work0226/litestruts/View.java
 create mode 100644 group16/502059278/src/cn/mark/work0226/litestruts/XMLUtils.java
 create mode 100644 group16/502059278/src/struts.xml

diff --git a/group16/502059278/.classpath b/group16/502059278/.classpath
index 3e0fb272a8..c0abaf014f 100644
--- a/group16/502059278/.classpath
+++ b/group16/502059278/.classpath
@@ -3,5 +3,6 @@
 	<classpathentry kind="src" path="src"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
+	<classpathentry kind="lib" path="src/lib/dom4j-1.6.1.jar"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>
diff --git a/group16/502059278/src/cn/mark/work0226/ArrayUtil.java b/group16/502059278/src/cn/mark/work0226/ArrayUtil.java
index 83ce45830f..94e253e8bb 100644
--- a/group16/502059278/src/cn/mark/work0226/ArrayUtil.java
+++ b/group16/502059278/src/cn/mark/work0226/ArrayUtil.java
@@ -22,10 +22,7 @@ public void reverseArray(int[] origin){
 		System.out.println("置换后："+Arrays.toString(target));
 		
 		
-		 Math.random();
-		 
-		
-		
+
 	}
 	
 	/**
diff --git a/group16/502059278/src/cn/mark/work0226/litestruts/LoginAction.java b/group16/502059278/src/cn/mark/work0226/litestruts/LoginAction.java
new file mode 100644
index 0000000000..4966d7d170
--- /dev/null
+++ b/group16/502059278/src/cn/mark/work0226/litestruts/LoginAction.java
@@ -0,0 +1,39 @@
+package cn.mark.work0226.litestruts;
+
+/**
+ * 这是一个用来展示登录的业务类， 其中的用户名和密码都是硬编码的。
+ * @author liuxin
+ *
+ */
+public class LoginAction{
+    private String name ;
+    private String password;
+    private String message;
+
+    public String getName() {
+        return name;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public String execute(){
+            if("test".equals(name) && "1234".equals(password)){
+                this.message = "login successful";
+                return "success";
+            }
+            this.message = "login failed,please check your user/pwd";
+            return "fail";
+    }
+
+    public void setName(String name){
+        this.name = name;
+    }
+    public void setPassword(String password){
+        this.password = password;
+    }
+    public String getMessage(){
+        return this.message;
+    }
+}
diff --git a/group16/502059278/src/cn/mark/work0226/litestruts/Struts.java b/group16/502059278/src/cn/mark/work0226/litestruts/Struts.java
new file mode 100644
index 0000000000..93a449adaf
--- /dev/null
+++ b/group16/502059278/src/cn/mark/work0226/litestruts/Struts.java
@@ -0,0 +1,84 @@
+package cn.mark.work0226.litestruts;
+
+import java.io.File;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.dom4j.Attribute;
+import org.dom4j.Document;
+import org.dom4j.Element;
+import org.dom4j.io.SAXReader;
+
+
+
+public class Struts {
+
+    public static View runAction(String actionName, Map<String,String> parameters) {
+
+        /*
+         
+		0. 读取配置文件struts.xml
+ 		
+ 		1. 根据actionName找到相对应的class ， 例如LoginAction,   通过反射实例化（创建对象）
+		据parameters中的数据，调用对象的setter方法， 例如parameters中的数据是 
+		("name"="test" ,  "password"="1234") ,     	
+		那就应该调用 setName和setPassword方法
+		
+		2. 通过反射调用对象的exectue 方法， 并获得返回值，例如"success"
+		
+		3. 通过反射找到对象的所有getter方法（例如 getMessage）,  
+		通过反射来调用， 把值和属性形成一个HashMap , 例如 {"message":  "登录成功"} ,  
+		放到View对象的parameters
+		
+		4. 根据struts.xml中的 <result> 配置,以及execute的返回值，  确定哪一个jsp，  
+		放到View对象的jsp字段中。
+        
+        */
+    	String classPath = null;
+    	String className = null;
+    	
+    	Document dom = XMLUtils.getDocument("bin"+File.separator+"struts.xml");
+    	Element ele = XMLUtils.getElement(dom, actionName);
+    	Attribute classAttr = ele.attribute("class");
+		classPath = classAttr.getValue();
+		className = classPath.substring(classPath.lastIndexOf(".")+1);
+    	System.out.println(className);
+    	
+    	
+    	
+		try {
+			Class clz = Class.forName(classPath);
+			System.out.println(clz.getName());
+			
+		
+			
+		} catch (ClassNotFoundException e) {
+			e.printStackTrace();
+		}  catch (SecurityException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (IllegalArgumentException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} 
+    	
+    	
+    	return null;
+    }    
+
+    
+    public static void main(String[] args) {
+    	
+    	String actionName = "login";
+        
+		Map<String,String> params = new HashMap<String,String>();
+        params.put("name","test");
+        params.put("password","1234");
+        
+        
+       Struts.runAction(actionName,params);        
+	}
+}
diff --git a/group16/502059278/src/cn/mark/work0226/litestruts/StrutsTest.java b/group16/502059278/src/cn/mark/work0226/litestruts/StrutsTest.java
new file mode 100644
index 0000000000..1a60626460
--- /dev/null
+++ b/group16/502059278/src/cn/mark/work0226/litestruts/StrutsTest.java
@@ -0,0 +1,43 @@
+package cn.mark.work0226.litestruts;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+
+
+
+
+public class StrutsTest {
+
+	@Test
+	public void testLoginActionSuccess() {
+		
+		String actionName = "login";
+        
+		Map<String,String> params = new HashMap<String,String>();
+        params.put("name","test");
+        params.put("password","1234");
+        
+        
+        View view  = Struts.runAction(actionName,params);        
+        
+        Assert.assertEquals("/jsp/homepage.jsp", view.getJsp());
+        Assert.assertEquals("login successful", view.getParameters().get("message"));
+	}
+
+	@Test
+	public void testLoginActionFailed() {
+		String actionName = "login";
+		Map<String,String> params = new HashMap<String,String>();
+        params.put("name","test");
+        params.put("password","123456"); //密码和预设的不一致
+        
+        View view  = Struts.runAction(actionName,params);        
+        
+        Assert.assertEquals("/jsp/showLogin.jsp", view.getJsp());
+        Assert.assertEquals("login failed,please check your user/pwd", view.getParameters().get("message"));
+	}
+}
diff --git a/group16/502059278/src/cn/mark/work0226/litestruts/View.java b/group16/502059278/src/cn/mark/work0226/litestruts/View.java
new file mode 100644
index 0000000000..31e3df3427
--- /dev/null
+++ b/group16/502059278/src/cn/mark/work0226/litestruts/View.java
@@ -0,0 +1,23 @@
+package cn.mark.work0226.litestruts;
+
+import java.util.Map;
+
+public class View {
+	private String jsp;
+	private Map parameters;
+	
+	public String getJsp() {
+		return jsp;
+	}
+	public View setJsp(String jsp) {
+		this.jsp = jsp;
+		return this;
+	}
+	public Map getParameters() {
+		return parameters;
+	}
+	public View setParameters(Map parameters) {
+		this.parameters = parameters;
+		return this;
+	}
+}
diff --git a/group16/502059278/src/cn/mark/work0226/litestruts/XMLUtils.java b/group16/502059278/src/cn/mark/work0226/litestruts/XMLUtils.java
new file mode 100644
index 0000000000..2eeb6e624e
--- /dev/null
+++ b/group16/502059278/src/cn/mark/work0226/litestruts/XMLUtils.java
@@ -0,0 +1,49 @@
+package cn.mark.work0226.litestruts;
+
+import java.util.List;
+
+import org.dom4j.Attribute;
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.Element;
+import org.dom4j.io.SAXReader;
+
+public class XMLUtils {
+	/**
+	 * 获取Document
+	 * @param filePath 配置文件路径名
+	 * @return Document对象
+	 */
+	public static Document getDocument(String filePath){
+		//1.创建解析器
+		SAXReader reader = new SAXReader();
+		//2.解析XML文档，返回document对象
+		Document dom = null;
+		try {
+			dom = reader.read(filePath);
+		} catch (DocumentException e) {
+			e.printStackTrace();
+		}
+		return dom;
+	}
+	/**
+	 * 获取指定action元素
+	 * @param doc Document
+	 * @param actionName 要获取的元素属性名
+	 * @return 包含所要属性的元素
+	 */
+	public static Element getElement(Document doc , String actionName){
+		Element result = null;
+		Element root = doc.getRootElement();
+    	List<Element> elements = root.elements();
+    	for(Element e : elements){
+    		Attribute attr = e.attribute("name");
+    		if(attr.getValue().equals(actionName)){
+    			result = e;
+    			return result;
+    		}
+    	}
+		return result;
+	}
+	
+}
diff --git a/group16/502059278/src/struts.xml b/group16/502059278/src/struts.xml
new file mode 100644
index 0000000000..1aaa6ea5a0
--- /dev/null
+++ b/group16/502059278/src/struts.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<struts>
+    <action name="login" class="cn.mark.work0226.litestruts.LoginAction">
+        <result name="success">/jsp/homepage.jsp</result>
+        <result name="fail">/jsp/showLogin.jsp</result>
+    </action>
+    <action name="logout" class="cn.mark.work0226.litestruts.LogoutAction">
+    	<result name= "success">/jsp/welcome.jsp</result>
+    	<result name= "error">/jsp/error.jsp</result>
+    </action>
+</struts>
\ No newline at end of file
