import java.util.*; import java.awt.Point; class Pattern { private int img[]; private int width; private int height; private Vector edge; public Pattern(int img[],int width,int height) { this.img = new int[width*height]; this.width = width ; this.height = height ; for(int i=0;i < width*height;i++) { this.img[i] = img[i]; } edge = new Vector(); } public int index(int x,int y) { if( 0 <= x && x0) {try{ sum = 0; if(index(x,y+1) > 0){sum++;} if(index(x+1,y+1) > 0){sum++;} if(index(x+1,y) > 0){sum++;} if(index(x+1,y-1) > 0){sum++;} if(index(x-1,y-1) > 0){sum++;} if(index(x-1,y) > 0){sum++;} if(index(x-1,y+1) > 0){sum++;} if(index(x,y-1) > 0){sum++;} if(sum == 1) { edge.add(new Point(x,y)); edge_sum++; } }catch(Exception e){;}} } return edge_sum; } }