|
Hi...
I have to call a csharp function in Java.
Can somebody give me a small example of how to do this.
Please do help me out.
yogesh
|
|
|
|
|
Do you have a scroll wheel on your mouse?
Scroll down two topics. (hint[^])
My failometer is detecting vast quantities of FAIL!
"Its SQL - hardly programming..." (Caslen)
|
|
|
|
|
Same post in like 3 forums in 1 day. Nice.
|
|
|
|
|
Hy guys ! i'm having a problem getting my tcp server applet on it's feet, the problem is that it doesn't get past instantiating a socket, if i instatiate it with port nr 80 it throws an exception ( Address already in use: JVM_Bind ), with other ports it just locks up at the "binding port" part
ServerSocket server;
int port= Integer.parseInt(portNumber.getText());
status.setText("Starting server..\n");
try {
status.append("Binding to port " + port + ", please wait ...\n");
server = new ServerSocket(port);
} catch (IOException ioe) {
status.append("EROARE la creearea socketului\nEXCEPTIE:
"+ioe.getMessage()+"\n");
return;
}
does anybody have a clue why this happens?
|
|
|
|
|
i'm uploading the server class and test web page if it will help sort this out
here it is : [url]http://uploading.com/files/XQ0TGHPT/server.rar.html[/url]
|
|
|
|
|
I couldn't say why a port might lock up, but if you're using windows you could run the "netstat -a -b" command with arguments to determine if the ports you are selecting are in use. The -b parameter will also tell you what process is using the port in question.
At a minimum, that will tell you if a port you are trying to use is available or not. If you have an appserver installed and running, (or even skype), one of them may be using port 80.
|
|
|
|
|
You might have something else on port 80?
This is the main port used by HTTP, so if you've got another web-service it may well be in use.
Try running it up pointing to a DIFFERENT port and see what happens.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
[quote]You might have something else on port 80?
This is the main port used by HTTP, so if you've got another web-service it may well be in use.
Try running it up pointing to a DIFFERENT port and see what happens.
[/quote]
allready tried , it locks up at the ServerSocket instantiation, and starting today it lock up on 80 too, i have absolutelly no clue what i'm doing wrong
|
|
|
|
|
Hi...
I have to call a csharp function in Java.
Can somebody give me a small example of how to do this.
Please do help me out.
Thnx.
|
|
|
|
|
All the references I have come across require a bridge between the two environments. The most common approach, used for ad-hoc projects as well as commercial solutions, is to wrap the two sides with a coms layer sending XML messages.
Have a google for 'java c# interop' and read up on the subject.
Also see here[^]
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Thnx for the help, i'll check it out.
|
|
|
|
|
|
|
hi all..
i want to convert an integer number into 8 bits ..
for example : if the Integer number is 5 , i want it to be 00000101.
and i need the zero's in my output..
i'll be very thankful if any one have an idea ..
|
|
|
|
|
And what exactly are you having trouble with?
Couldn't you just do something like:
boolean[] b = new boolean[8];
for (int i = 0; i < 8; i++)
{
b[7 - i] = (x & 1) == 1;
x >>= 1;
}
warning: untested
Or something that looks just like it. Perhaps an array of ints like this:
int[] b = new int[8];
for (int i = 0; i < 8; i++)
{
b[7 - i] = x & 1;
x >>= 1;
}
Or perhaps not 7 - i but just i
|
|
|
|
|
I have a picture added to my jpanel content pane like this:
imagePanel = new ImagePanel();<br />
contentPane.add(imagePanel, BorderLayout.CENTER);
File selectedFile = new File("map.jpg");
currentImage = ImageFileManager.loadImage(selectedFile);
imagePanel.setImage(currentImage);
frame.pack();
How I can draw a circle on top of that loaded picture?
Thanks in advance, Im new in this area.
|
|
|
|
|
this is the binary search tree class as you can see the class is developed using generics the problem coming is in testing methods when i m passing integer as two parameters i m not sure why the error is coming whereas the cast i feel is correct ....
*
* Variables: root : marks the root of the tree, null if empty
*
* Inner classes:
* Node: implements each linked node. Defined as protected since only
* descendant classes need to access it
* Variables: key: polymorphic comparable key
* item: polymorphic data in the node
* left: reference to the left subtree
* right: reference to the right subtree
* Methods: Node(K thisKey, T thisItem)
* Node(K thisKey, T thisItem, Node l, Node r)
*
* Public methods: boolean isEmpty()
* void clear()
* boolean find(T item)
* void insert(T item)
* void printPreOrder()
* void printInOrder()
* void printPostOrder()
*
* Input: none
*
* Output: only for regression testing
*
* Error handling: none
*
* Regression testing: a private testing method for each public method
* except for find and for insert (since this is
* asked for during the prac).
*/
public class BinarySearchTree<K extends Comparable<K>,T extends Comparable<T>>
{
// Invariants for the class (and all its descendandts):
// (1) the tree is binary: all nodes have at most two children
// (2) for every node n, they key at n is greater than the key of any left
// descendant, and smaller than the key of any right descendant
// (3) Corollary: no key appears twice in the tree
protected Node root;
protected class Node
{ protected K key;
protected SortedLList<T> item;
protected Node left;
protected Node right;
// Creates a new leaf node of the tree with the appropriate data
//
// precondition: none new
// postcondition: a leaf node object is created with key data thisKey
// and item thisItem
// Best and worst case: O(1)
protected Node(K thisKey, SortedLList<T> thisItem)
{ key = thisKey; item = thisItem;
left = null; right = null;}
// Creates a new node of the tree with the appropriate data and pointing
// to the given left and right children nodes
//
// precondition: none new
// postcondition: a node object is created with key data thisKey
// item thisItem, and left and right nodes pointing to l and r, resp.
// Best and worst case: O(1)
protected Node(K thisKey, SortedLList<T> thisItem, Node l, Node r)
{ key = thisKey; item = thisItem;
left = l; right = r;}
} // end of the Node class
public BinarySearchTree()
{ root = null;}
// Used to check whether the tree is empty
//
// postcondition: if true the tree is empty, otherwise it is not
// Best and worst case: O(1)
public boolean isEmpty()
{ return (root == null);}
// Resets the tree to an empty state
//
// precondition: none new
// postcondition: the tree is empty
// Best and worst case: O(1)
public void clear()
{ root = null;}
// Used to check whether a node with the given key appears in the tree
// Achieved by descending through the tree performing binary search
// until the key is found or an empty node is reached.
//
// precondition: none new
// postcondition: if it returns null the key does not apper in the tree,
// otherwise it does
// Complexity: if compareTo is O(M) where M is the size of K, then best
// case O(M) when the key is at the root, worst O(D*M) when
// it does not find it and has traversed the maximum depth
// D of the tree
public boolean find(K thisKey)
{ return find(root,thisKey);}
protected boolean find(Node current, K thisKey)
{ if (current != null)
{ int comp = current.key.compareTo(thisKey);
if (comp > 0) // thisKey is greater than the current root
{return find(current.left, thisKey);}
else if(comp == 0) // found it
{return true;}
else // comp < 0 // thisKey is smaller than the current root
{return find(current.right, thisKey);}
}
else {return false;}
}
// Used to insert a node with the given key and item, giving an error if
// the key already appears in the tree with a different item. Achieved by
// descending through the tree performing binary search, until the
// appropriate empty node is reached, at which point the new leaf node is
// added and linked
//
// precondition: none new
// postcondition: if an error is printed the tree is unchanged and already
// contains a node with the given key and differen item. Otheriwse,
// if the tree is unchanged it already has a node with that key and
// else, the tree has a new leaf node with key thisKey and item newItem
// Complexity: if compareTo is O(M) where M is the size of K and equals
// is O(P) where P is the size of T, then best case is
// O(M)+O(P), when when both the key and the item are at the
// root, worst case O(D*M) occurs when the key does not appear
// in the tree and it has traversed the maximum depth D of the
// tree
public void insert(K thisKey, SortedLList<T> newItem)
{ if (root == null)
{root = new Node(thisKey, newItem);}
else
{insert(root, thisKey, newItem);}
}
protected void insert(Node current, K thisKey, SortedLList<T> newItem)
{ int comp = current.key.compareTo(thisKey);
if (comp > 0)
{if (current.left == null)
{current.left = new Node(thisKey,newItem);}
else {insert(current.left,thisKey,newItem);}}
else if (comp < 0)
{if (current.right == null)
{current.right = new Node(thisKey,newItem);}
else {insert(current.right,thisKey,newItem);}}
else // comp == 0
{if (!current.item.equals(newItem))
{System.out.println("Error: Already in");}}
}
public void printInOrder()
{ printInOrder(root);}
protected void printInOrder(Node current)
{
if (current != null)
{
printInOrder(current.left);
System.out.print("key is "+current.key+" ");
System.out.print("and item is "+current.item+" ");
printInOrder(current.right);
}
}
// Used to print all items following preOrder of the nodes and with a space
// in between each item
//
// precondition: none new
// postcondition: the item of every node is printed in preOrder (first the
// item node, then the items in the left-subtree, then in
// right-subtree
// Complexity: if print is O(M) where M is the max size of an item, best case
// and worst case is O(N*M) where N is the number of elements
// in the tree
public void printPreOrder()
{ printPreOrder(root);}
protected void printPreOrder(Node current)
{ if (current != null)
{ System.out.print(current.item+" ");
printPreOrder(current.left);
printPreOrder(current.right);
}
}
// Used to print all items following postOrder of the nodes and with a space
// in between each item
//
// precondition: none new
// postcondition: the item of every node is printed in postOrder (first the
// item node, then the items in the left-subtree, then in
// right-subtree
// Complexity: if print is O(M) where M is the max size of an item, best case
// and worst case is O(N*M) where N is the number of elements
// in the tree
public void printPostOrder()
{ printPostOrder(root);}
protected void printPostOrder(Node current)
{ if (current != null)
{ printPostOrder(current.left);
printPostOrder(current.right);
System.out.print(current.item+" ");
}
}
/* Two test classes: empty trees and non-empty trees
* Boundary analysis gives four cases: 0 elements, 1, 2, and many (5) */
private static void testIsEmpty()
{
BinarySearchTree<Integer,Integer> tree =
new BinarySearchTree<Integer,Integer>();
tree.clear();
System.out.println("TESTING isEmpty()");
System.out.println("Expected true, got "+tree.isEmpty());
tree.insert(4,4);
System.out.println("Expected false, got "+tree.isEmpty());
tree.insert(2,2);
System.out.println("Expected false, got "+tree.isEmpty());
tree.insert(5,5);
System.out.println("Expected false, got "+tree.isEmpty());
tree.insert(0,0);
tree.insert(12,12);
System.out.println("Expected false, got "+tree.isEmpty());
}
/* Two test classes: those that are already empty, and those that are not
* Boundary analysis gives four cases: 0 elements, 1, 2, and many (5) */
private static void testClear()
{
BinarySearchTree<Integer,Integer> tree =
new BinarySearchTree<Integer,Integer>();
tree.clear();
System.out.println("TESTING clear()");
System.out.println("Expected true, got "+tree.isEmpty());
tree.insert(4,4);
tree.clear();
System.out.println("Expected true, got "+tree.isEmpty());
tree.insert(4,4);
tree.insert(2,2);
tree.clear();
System.out.println("Expected true, got "+tree.isEmpty());
tree.insert(4,4);
tree.insert(2,2);
tree.insert(5,5);
tree.clear();
System.out.println("Expected true, got "+tree.isEmpty());
tree.insert(4,4);
tree.insert(2,2);
tree.insert(5,5);
tree.insert(0,0);
tree.insert(12,12);
tree.clear();
System.out.println("Expected true, got "+tree.isEmpty());
}
/* Not really any classes for traversing. The only test cases are due
* to the structure of the tree: nodes with no children, nodes with
* only a left subtree, only a right subtree, and with both. */
private static void testPrintPreOrder()
{
BinarySearchTree<Integer,Integer> tree =
new BinarySearchTree<Integer,Integer>();
tree.clear();
tree.insert(4,4);
tree.insert(3,3);
tree.insert(2,2);
tree.insert(5,5);
tree.insert(6,6);
System.out.print("TESTING printPreOrder, expected 4 3 2 5 6, got ");
tree.printPreOrder();
System.out.println(" ");
}
/* Not really any classes for traversing. The only test cases are due
* to the structure of the tree: nodes with no children, nodes with
* only a left subtree, only a right subtree, and with both. */
private static void testPrintPostOrder()
{
BinarySearchTree<Integer,Integer> tree =
new BinarySearchTree<Integer,Integer>();
tree.clear();
tree.insert(4,4);
tree.insert(3,3);
tree.insert(2,2);
tree.insert(5,5);
tree.insert(6,6);
System.out.print("TESTING printPostOrder, expected 2 3 6 5 4, got ");
tree.printPostOrder();
System.out.println(" ");
}
private static void testPrintInOrder()
{
BinarySearchTree<Integer,Integer> tree =
new BinarySearchTree<Integer,Integer>();
tree.clear();
tree.insert(4,4);
tree.insert(3,3);
tree.insert(2,2);
tree.insert(5,5);
tree.insert(6,6);
System.out.print("TESTING printInOrder, expected 2 3 4 5 6, got ");
tree.printInOrder();
System.out.println(" ");
}
public static void main(String[] args)
{
BinarySearchTree<Integer,Integer> tree = new BinarySearchTree<Integer,Integer>();
tree.testIsEmpty();
tree.testClear();
tree.testPrintPreOrder();
tree.testPrintInOrder();
tree.testPrintPostOrder();
}
}
now the sortedLList class
/* Class SortedLList<T extends Comparable<T>>
*
public class SortedLList<T extends Comparable<T>>
extends AbstractLList<T>
{
// New invariants for the class:
// (N) if node N points to node N', N.item is less or equal than N'
// Creates an empty object of the class, i.e., an empty list of T items
// Since the list is implemented with nodes, the size is not needed
//
// precondition: none new
// postcondition: an empty list is created
// Best and worst case: O(1)
public SortedLList()
{ head = null; last = null;}
// Inserts a new node with newItem to the list, making sure it is inserted
// before the first node whose item is greater or equal than newItem
//
// precondition: none new
// postcondition: a new node with newItem appears in the list
//
// Best case (should be inserted in first place) O(1)*O_compare where
// O_compare will tipically be O(M) where M is the length of newItem
// Worst case (in last place) O(N)*O_compare, where N is the length of
// the list
public void add(T newItem)
{
Iterator i = this.iterator();
while (i.hasNext() && i.peek().compareTo(newItem)<0)
{i.next();}
Node temp = new Node(newItem,i.current);
if (i.previous == null) // first element
{head = temp;}
else //middle or last element
{i.previous.next = temp;}
if (i.current == null) // last element
{last = temp;}
}
/*********************** REGRESSION TESTING CODE **********************/
// Two test classes: empty lists and non-empty lists
// Boundary analysis gives four cases: 0 elements, 1, 2, and many (5)
private static void testIsEmpty()
{ SortedLList<Integer> myList = new SortedLList<Integer>();
System.out.println("TESTING isEmpty()");
System.out.println("Expected true, got "+myList.isEmpty());
myList.add(9);
System.out.println("Expected false, got "+myList.isEmpty());
myList.add(0);
System.out.println("Expected false, got "+myList.isEmpty());
myList.add(1);
myList.add(2);
myList.add(14);
System.out.println("Expected false, got "+myList.isEmpty());
}
// Two test classes: full lists and non-full lists
// Boundary analysis gives three cases: 0 elements, 1, and many (5)
private static void testIsFull()
{ SortedLList<Integer> myList = new SortedLList<Integer>();
System.out.println("TESTING isFull()");
System.out.println("Expected false, got "+myList.isFull());
myList.add(9);
System.out.println("Expected false, got "+myList.isFull());
myList.add(0);
myList.add(1);
myList.add(2);
myList.add(14);
System.out.println("Expected false, got "+myList.isFull());
}
// One test class: adding to a list of any length
// Boundary analysis gives three cases: 0 elements, 1, and many (5)
private static void testAdd()
{ SortedLList<Integer> myList = new SortedLList<Integer>();
System.out.println("TESTING add()");
myList.add(0);
System.out.println("Expected 0, got "+myList);
myList.add(9);
System.out.println("Expected 0 9, got "+myList);
myList.add(1);
myList.add(14);
myList.add(20);
System.out.println("Expected 0 1 9 14 20, got "+myList);
}
// Two test classes: the item is not in the list and it is in it
// Subclasses for the class in which the item is in: is the first slot
// the last, or in the middle
// Boundary analysis gives five cases: slot 0, slot 1, slot used-2, slot
// used-1, and some slot in the middle
private static void testDeleteItem() throws Exception
{ SortedLList<Integer> myList = new SortedLList<Integer>();
myList.add(8);
myList.add(7);
myList.add(5);
myList.add(5);
myList.add(4);
myList.add(3);
myList.add(2);
myList.add(1);
myList.add(0);
System.out.println("TESTING deleteItem()");
System.out.println("Expected true, got "+ myList.deleteItem(5));
System.out.println(" with list 0 1 2 3 4 5 7 8, got "+myList);
System.out.println("Expected true, got "+ myList.deleteItem(1));
System.out.println(" with list 0 2 3 4 5 7 8, got "+myList);
System.out.println("Expected true, got "+ myList.deleteItem(0));
System.out.println(" with list 2 3 4 5 7 8, got "+myList);
System.out.println("Expected true, got "+ myList.deleteItem(7));
System.out.println(" with list 2 3 4 5 8, got "+myList);
System.out.println("Expected true, got "+ myList.deleteItem(8));
System.out.println(" with list 2 3 4 5, got "+myList);
System.out.println("Expected false, got "+ myList.deleteItem(8));
System.out.println(" with list 2 3 4 5, got "+myList);
}
// Two test classes: the list is empty and it is not
// Boundary analysis gives four cases: 0 elements, 1, 2, and many (5)
private static void testDeleteFirst() throws Exception
{ SortedLList<Integer> myList = new SortedLList<Integer>();
myList.add(4);
myList.add(3);
myList.add(2);
myList.add(1);
myList.add(0);
System.out.println("TESTING deleteFirst()");
System.out.println("Expected 0, got "+ myList.deleteFirst());
System.out.println(" with list 1 2 3 4, got "+myList);
myList.deleteFirst();
myList.deleteFirst();
System.out.println("Expected 3, got "+ myList.deleteFirst());
System.out.println(" with list 4, got "+myList);
System.out.println("Expected 4, got "+ myList.deleteFirst());
System.out.println(" with list , got "+myList);
System.out.print("Expected exception ");
try{myList.deleteFirst();}
catch(Exception e)
{ System.out.println(e);
return;}
System.out.println("but no exception thrown");
}
// Two test classes: the list is empty and it is not
// Boundary analysis gives four cases: 0 elements, 1, 2, and many (5)
private static void testDeleteLast() throws Exception
{ SortedLList<Integer> myList = new SortedLList<Integer>();
myList.add(4);
myList.add(3);
myList.add(2);
myList.add(1);
myList.add(0);
System.out.println("TESTING deleteLast()");
System.out.println("Expected 4, got "+ myList.deleteLast());
System.out.println(" with list 0 1 2 3, got "+myList);
myList.deleteLast();
myList.deleteLast();
System.out.println("Expected 1, got "+ myList.deleteLast());
System.out.println(" with list 0, got "+myList);
System.out.println("Expected 0, got "+ myList.deleteLast());
System.out.println(" with list , got "+myList);
System.out.print("Expected exception ");
try{myList.deleteLast();}
catch(Exception e)
{ System.out.println(e);
return;}
System.out.println("but no exception thrown");
}
// Two test classes: the item is not in the list and it is in it
// Subclasses for the class in which the item is in: is the first slot
// the last, or in the middle
// Boundary analysis gives five cases: slot 0, slot 1, slot used-2, slot
// used-1, and some slot in the middle
private static void testFind()
{ SortedLList<Integer> myList = new SortedLList<Integer>();
myList.add(0);
myList.add(1);
myList.add(2);
myList.add(14);
myList.add(20);
myList.add(30);
myList.add(40);
myList.add(50);
System.out.println("TESTING find()");
System.out.println("Expected false, got "+ myList.find(9));
System.out.println("Expected true, got "+ myList.find(0));
System.out.println("Expected true, got "+ myList.find(1));
System.out.println("Expected true, got "+ myList.find(14));
System.out.println("Expected true, got "+ myList.find(40));
System.out.println("Expected true, got "+ myList.find(50));
}
public static void main(String[] args) throws Exception
{
try{ testIsEmpty();
testIsFull();
testAdd();
testDeleteItem();
testDeleteFirst();
testDeleteLast();
testFind();
}
catch(Exception e)
{ System.out.println(" Error, unexpected exception: "+e);}
}
}
|
|
|
|
|
That's a ton of text....What's the error?
|
|
|
|
|
well I have been working on an assigment and it states::
A program has to be developed, and coded in C language, to decipher a document written
in Italian that is encoded using a secret key. The secret key is obtained as random
permutation of all the uppercase letters, lowercase letters, numbers and blank space. As
an example, let us consider the following two strings:
Plain: “ABCDEFGHIJKLMNOPQRSTUVXWYZabcdefghijklmnopqrstuvwxyz0123456789 ”
Code: “BZJ9y0KePWopxYkQlRjhzsaNTFAtM7H6S24fC5mcIgXbnLOq8Uid 3EDv1ruVGw”
The secret key modifies only letters, numbers, and spaces of the original document, while
the remaining characters are left unchanged. The document is stored in a text file whose
length is unknown.
The program has to read the document, find the secret key (which by definition is
unknown; the above table is just an example and it is not the key used for preparing the
sample files available on the web course) using a suitable decoding algorithm, and write
the decoded document to a new text file.
And I know that I have to upload an English dictionary into the program but I don't why it has been asked.(may be not in that statement but I have to dO THAT). My question is , while I can do that program using simple encryption/decryption algorithm then what's the use of uploading the english dictionary in our program? So is there any decryption algorithm that uses a dictionary to decrypt an encrypted file? or can somebody tell me what approach or algorithm should I use to solve that problem???
An early reply (and also authentic one) will be highly appreciated from you.
Thank you guys.
|
|
|
|
|
Hi. On your second line you specifically wrote that this has to be written in C. This is the Java forum. At the end of your problem statement, your question is a request for an Algorithm.
So either post this in the C forums, or the algorithm one. This should not be here.
|
|
|
|
|
yes, but i POSTED IT HERE. So if to seek help from any of the Java programmers who has already worked on this encryption decryption program or related to that one.
|
|
|
|
|
i'd tried to make image from the given file name.but i failed..
can you tell me how to do it.
i use this as my code
fc = new FileChooser("image", "Open");
_fnSrcCom = fc.getFileName();
Image pic = Toolkit.getDefaultToolkit().createImage(_fnSrcCom);
int width=pic.getWidth(null);
int height=pic.getHeight(null);
int Size = width * height;
i get width = 240
height=-1
and size = -240
the original width of the image is 180x240
|
|
|
|
|
Hi all,
A bit of advice required. I have been contacted by a client who has an iPhone application that talks to web services hosted on a J2EE Application Server. We are entertaining the idea of offering him a hosting solution on our existing server.
Our server is Windows 2003 Standard running IIS6 and Sql Server 2005. We already host a nubmer of websites (all .NET).
Firstly, are there any implications for trying to run a J2EE application server alongside IIS, and does anyone have any recommendation for an application server.
I know this question is vague but I'm just trying to figure out if its even worth pursuing at this point.
Thanks
The only thing unpredictable about me is just how predictable I'm going to be.
|
|
|
|
|
Of course, IIS & J2EE application server reside in the same host. You may install - Apache Tomcat 6.x or GlassFish.
A DATAPOST COMPUTER CENTRE
(K.V Prajapati)
|
|
|
|
|
could any one tell me how to do zigzag scanning in java. i was doing it in c++
i was use this in c#
struct zigzag
{
int row;
int col;
} ZigZag[8*8] =
{
{0,0},
{0,1},{1,0},
{2,0},{1,1},{0,2},
{0,3},{1,2},{2,1},{3,0},
{4,0},{3,1},{2,2},{1,3},{0,4},
{0,5},{1,4},{2,3},{3,2},{4,1},{5,0},
{6,0},{5,1},{4,2},{3,3},{2,4},{1,5},{0,6},
{0,7},{1,6},{2,5},{3,4},{4,3},{5,2},{6,1},{7,0},
{7,1},{6,2},{5,3},{4,4},{3,5},{2,6},{1,7},
{2,7},{3,6},{4,5},{5,4},{6,3},{7,2},
{7,3},{6,4},{5,5},{4,6},{3,7},
{4,7},{5,6},{6,5},{7,4},
{7,5},{6,6},{5,7},
{6,7},{7,6},
{7}
}
i use this in java..
//the initiation
protected int zigzag[][] = {
{0, 1, 5, 6,14,15,27,28},
{2, 4, 7,13,16,26,29,42},
{3, 8,12,17,25,30,41,43},
{9,11,18,24,31,40,44,53},
{10,19,23,32,39,45,52,54},
{20,22,33,38,46,51,55,60},
{21,34,37,47,50,56,59,61},
{35,36,48,49,57,58,62,63},
};
//the method
public void zigZagScan(int blkIn[][],int buffOut[])
/* Desk: Method for zigzag scanning as a pattern of scanning in RLE
I.S : array 2D of 8x8
F.S : array 1D of 64
*/
{
int row, col;
for (i=0;i<64 ;i++ )
{
row = zigzag[i]; //i want to use row = zigzag[i].row
col = zigzag[i]; //i want to use col = zigzag[i].col
buffOut[i]=blkIn[row][col];
}
}
could any one tell me what is the suitable sintax in java?
thanx
|
|
|
|
|