Coding binary in Java, how is it stored or extracted? Please assist

Hey people i came across the code below in a puzzle game and i dont really understand how binary coding works with java. could some one explain how this code would be store or extracted? Is the code below how it would be stored? please explain
public static final int MASK_X = 0xF0000000;
public static final int MASK_Y = 0x0F000000;
public static final int MASK_PUZZLE_VAL = 0x000000F0;
public static final int MASK_GRID_VAL = 0x0000000F;
public static final int MASK_NOTES = 0x0001FF00;
public static final int MASK_IS_DEFAULT = 0x00100000;
public static final int MASK_IS_EDITABLE = 0x00200000;
public static final int MASK_IS_HINT = 0x00400000;
private static final int HEX1FF = 0x1ff; // what is this line doing?
Cheers!

As noted above, this is hexadecimal. So rather than using base 10, this uses base 16 so that the right hand number is simply that number (with A = 10, B = 11, C = 12... F = 15). The next column of number represents the 16 column and is multiplied by 16, the next column represents the 16x16 column... so that:
0x1FF means
1 * 16 * 16 +
15 * 16 +
15

Similar Messages

  • How to call stored procedures from java program?

    I have tried to run a program that calls a stored procedure on MySQL
    server version 5.0.17 by using connector/j 5.0, but it always fails on the
    statement: con.preparecall() ,
    have looked on the internet and found out that people can all mysql
    stored procedure all right in their programs, really dont know what's
    wrong with this small peiece of code:
    import java.sql.*;
    public class TestDB {
          // procedure being called is:
         CREATE PROCEDURE `dbsaystorm`.`getsite` ()
         BEGIN
            select  name  from tblsite;
         END
         public static void main(String[] args) {
              try  {
                  //Class.forName("org.gjt.mm.mysql.Driver");
                  Class.forName("com.mysql.jdbc.Driver");
                  Connection con = DriverManager.getConnection("jdbc:mysql://localhost/dbname",
                            "user", "pwd");
           * executing SQL statement here gives perfect correct results:
            // PreparedStatement ps = con.prepareStatement("select name from tblsite");      
            // ResultSet rs =ps.executeQuery();
                  // but in stored procedure way...
                  //it fails here on this prepare call statement:             
                  CallableStatement proc = con.prepareCall("call getsite()");
                  ResultSet rs =proc.executeQuery();                      
                  if (rs == null) return;                                      
                  while (rs.next()){                 
                      System.out.println("site name is: "+ rs.getString(1));                                
                  rs.close();
              } catch (SQLException e) {e.printStackTrace();}
               catch (Exception e) {e.printStackTrace();}         
    }it always gives this exception:
    java.lang.NullPointerException
         at com.mysql.jdbc.StringUtils.indexOfIgnoreCaseRespectQuotes(StringUtils.java:959)
         at com.mysql.jdbc.DatabaseMetaData.getCallStmtParameterTypes(DatabaseMetaData.java:1280)
         at com.mysql.jdbc.DatabaseMetaData.getProcedureColumns(DatabaseMetaData.java:3668)
         at com.mysql.jdbc.CallableStatement.determineParameterTypes(CallableStatement.java:638)
         at com.mysql.jdbc.CallableStatement.<init>(CallableStatement.java:453)
         at com.mysql.jdbc.Connection.parseCallableStatement(Connection.java:4365)
         at com.mysql.jdbc.Connection.prepareCall(Connection.java:4439)
         at com.mysql.jdbc.Connection.prepareCall(Connection.java:4413)
         at saystorm.server.data.database.TestDB.main(TestDB.java:29)
    where have I gone wrong?
    when I commented out the statement that makes the procedure call and call preparedstatement to execute SQL select statement, it gave perfectly correct result.
    it looks like there is no problem with java prog accessing MYSQL server database, but the it seems that it's just java can't call stored procedure stored on the mysql server version 5.
    can it or can't it? if it can, how is that accomplished?

    It is a bug in the driver because it shouldn't be
    returning that exception (null pointer) even if you
    are doing something wrong.
    Are you using the latest version of the driver?
    The stored procedure runs when you run it from the
    gui/command line using a MySQL tool - correct?
    As suggested you should be using the brackets. What
    is the data type of the 'name' field?
    You could try returning another value like one of the
    following
    select 1, name from tblsite;
    select name, 1 from tblsite;
    That might get around the bug
    Additionally try just the following...
    select 'test' from tblsite;yes, the driver used is in connector/j 5.0--the lastest one, and the
    procedure can run correctedly at either command line or GUI mode
    with no problem whatsoever, the returned data type is string type,
    I have not got the chance to test it again with those values you
    suggested, as I have abandoned the laptop I used to write that code
    initately. There have been some other really weird cases happened on
    that computer. I guess that must be something wrong with the JVM
    installed on it, it was upgraded from jre5.0.04 to 06, and to 09.
    something within hte JVM must have been messed up(the only reasonable
    explanation). Because the same code runs correctly on my new laptop,
    using the same environment: jvm 5.0_09, mysql 5.0.18, connector/J 5.0.
    that old laptop really was a nightmare.

  • HOW TO USE STORED PROCEDURES IN JASPERREPORTS(URJENT)

    Hi,
    i'm using jasperreports in struts based project. How to use stored procedures in jasperreports. pls send the solution urjent
    Thanks in advance
    ramesh

    Hi,
    Refer the below link:
    JDBC:
    Receiver JDBC scenario MS access - /people/sameer.shadab/blog/2005/10/24/connecting-to-ms-access-using-receiver-jdbc-adapter-without-dsn
    /people/sap.user72/blog/2005/06/01/file-to-jdbc-adapter-using-sap-xi-30 --> for jdbc receiver: file -JDBC
    Stored Procedures-
    /people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
    http://www.ics.com/support/docs/dx/1.5/tut6.html
    /people/sriram.vasudevan3/blog/2005/02/14/calling-stored-procs-in-maxdb-using-sap-xi
    http://www.ics.com/support/docs/dx/1.5/tut6.html
    http://java.sun.com/docs/books/tutorial/jdbc/basics/sql.html
    http://www.sqlteam.com/article/stored-procedures-an-overview
    HI in the message mapping structure u need to specify the different action and also u need to specify the procedure name.
    refer the below link which has all the associated action
    http://help.sap.com/saphelp_nw04s/helpdata/en/22/b4d13b633f7748b4d34f3191529946/frameset.htm
    Chirag

  • How to use Stored Procedures in JDBC sender side and receiver side

    Hello,
    Can anyone explain how to use stored procedures in configuring the scenario using JDBC adapter at bothe sides sender nad receiver..
    Thanks,
    Soorya

    Hi,
    Refer the below link:
    JDBC:
    Receiver JDBC scenario MS access - /people/sameer.shadab/blog/2005/10/24/connecting-to-ms-access-using-receiver-jdbc-adapter-without-dsn
    /people/sap.user72/blog/2005/06/01/file-to-jdbc-adapter-using-sap-xi-30 --> for jdbc receiver: file -JDBC
    Stored Procedures-
    /people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
    http://www.ics.com/support/docs/dx/1.5/tut6.html
    /people/sriram.vasudevan3/blog/2005/02/14/calling-stored-procs-in-maxdb-using-sap-xi
    http://www.ics.com/support/docs/dx/1.5/tut6.html
    http://java.sun.com/docs/books/tutorial/jdbc/basics/sql.html
    http://www.sqlteam.com/article/stored-procedures-an-overview
    HI in the message mapping structure u need to specify the different action and also u need to specify the procedure name.
    refer the below link which has all the associated action
    http://help.sap.com/saphelp_nw04s/helpdata/en/22/b4d13b633f7748b4d34f3191529946/frameset.htm
    Chirag

  • How to call stored procedure in hibernate

    hi ,
    can any one help me how to call stored procedure in hibernate.Given code in hbm.xml
    and also plz tell me what is the use of <return-property/>in given hbm.xml file.
    <sql-query name="selectEmployees_SP" callable="true">
         <return alias="emp" class="com.centris.Employee">
    <return-property name="eno" column="eno"/>
    <return-property name="ename" column="ename"/>
    <return-property name="address" column="address"/>
    <return-property name="salary" column="salary"/>
    { ? = call p_retrieve_employees() }
    </return>
    </sql-query>

    Hi,
    Your question isn't related to Java Programming and should be asked in a [Hibernate forum|http://forum.hibernate.org/]
    Kaj

  • How to display stored procedure results in SJSC table?

    I have been able to create a cached rowset and debug/watch the results, but do not understand how to transfer those results to a Table component. Can anyone point me in the right direction?
    Details:
    In SessionBean1.java, I declared the stored procedure and rowset along with get/set and update procedures:
    // SLS trying stored procedure 20060412
        private java.sql.CallableStatement spFXRatesStatement; 
        private CachedRowSetXImpl spFXRatesRowSet = new CachedRowSetXImpl();
        public CachedRowSetXImpl getSpFXRatesRowSet() {
            return spFXRatesRowSet;
        public void setSpFXRatesRowSet(CachedRowSetXImpl crsxi) {
            this.spFXRatesRowSet = crsxi;
        public void updateSpFXRatesRowSet(String inDate, String inCcy) {
            try {
                spFXRatesStatement.setString(1, inDate);
                spFXRatesStatement.setString(2, inCcy);
                spFXRatesRowSet.populate(spFXRatesStatement.executeQuery(), 1);
            catch (Exception e) {
                // TODO - write exception code
    // SLS trying stored procedure 20060412I then �prepared� the stored procedure within SessionBean1�s init() procedure:
    // SLS trying a stored proc 20060412
            try {
                javax.naming.Context ctx = new javax.naming.InitialContext();
                javax.sql.DataSource ds = (javax.sql.DataSource)ctx.lookup("java:comp/env/jdbc/bmo_fp");
                java.sql.Connection conn = ds.getConnection();
                // spGetFXRates
                spFXRatesStatement = conn.prepareCall("{call GetFXRates(?, ?)}",
                        java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE, java.sql.ResultSet.CONCUR_READ_ONLY);          
               // next sp...
                // clean up
                ctx.close();
                conn.close();
            catch (Exception e) {
                // TODO - add exception code
    // SLS 20060412 I can see the results in a web page procedure with a �getSessionBean1().getSpFXRatesRowSet().getString(i)� watch.
    try {
                getSessionBean1().updateSpFXRatesRowSet("9/30/2005","EUR");
                getSessionBean1().getSpFXRatesRowSet().first();
                while (getSessionBean1().getSpFXRatesRowSet().isLast() != true) {
                    getSessionBean1().getSpFXRatesRowSet().next();
            catch (Exception e) {
                // TODO - specify error detail
            }Now, how do I transfer these results to a table?

    I think you have to add a CachedRowSetDataProvider to you page been.
    Then initalize it with your getSpFXRatesRowSet() in the init() method.
    Then link you table to the CachedRowSetDataProvider.

  • How are variable stored?

    Hi,
    I'd like to know how variables are stored internally in the class file. Does Java uses an offset to refers to variable or something else? If it uses an offset it is possible to store "duplicated" variables (i.e., variables with the same name) keeping them separated, but in article of Gosling (I don't remember which) I read that Java tries to not use offsets. Can anybody explain me this?
    Luca

    Everything resolves down to references really !
    For local variables...
    A "frame" is created in the JVM, for every method being executed.
    Inside that frame is basically an array of "variable slots".
    The VM doesn't care about field names at this stage and just uses indexes.
    It's only at compile time that field names are considered.
    If you compile a class with debugging information, then then the compiler includes a "Local Variable Table". This is purely for debugging, not for the VM, and it maps field names to field positions.
    If you don't include debugging information, then it's not included... the VM doesn't care.
    For class field variables...
    The class file format is quite strict.
    No, you can't / shouldn't have duplicate class fields.
    The compiler has to resolve the references down to proper indices at compile time.
    regards,
    Owen

  • How to use Stored Procedure Call in Sender JDBC adapter

    Hi All,
             Could someone send me a blog on how to use Stored Procedure call in Sender JDBC adapter?
    Xier

    Hi Xler
    refer these links
    /people/yining.mao/blog/2006/09/13/tips-and-tutorial-for-sender-jdbc-adapter
    http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
    Also, you can check Sriram's blog for executing Stored Procedures,
    /people/sriram.vasudevan3/blog/2005/02/14/calling-stored-procs-in-maxdb-using-sap-xi
    /people/jegathees.waran/blog/2007/03/02/oracle-table-functions-and-jdbc-sender-adapter
    This blog might be helpfull on stored procedures for JDBC
    JDBC Stored Procedures
    /people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
    Please go through these threads and see if it helps...
    Re: How to execute Stored Procedure?
    Re: Problem with JDBC stored procedure
    Thnaks !!

  • How to modify stored procedures in SQL Azure database in SQL server express 2012

    Hi,
    I want to modify stored procedures in SQL Azure database in SQL Server Express 2012. But when right click on the stored procedure in Object Explorer, there is no option "Modify" as for SQL Server database. I wonder how to modify stored procedures in SQL
    Azure database in SQL Server Express 2012. Thanks.
    York

    Hi,
    Not sure whay there is no modify..
    As a workaround can you try this and see if you can modify proc..
    Script Procedure As-> Alter To->New query window..
    - Chintak (My Blog)

  • How to use Stored Procedures in form 6i Blocks

    Dear Friends,
    I would like to know how to use Stored Procedures while creating blocks in Data Block Wizard in forms 6i application.
    Please send me sample code of stored procedure.
    Regards,
    Khader.

    The Data Block Wizard is not for creating stored procedures. It will allow you to use a stored procedure in your form. See the help documentation for how to use the wizard.
    Here's an example of a simple procedure. If you search the database forum or the web, you will find many examples.
    CREATE OR REPLACE PROCEDURE procedure_name (value OUT NUMBER ) AS
    BEGIN
    SELECT COUNT(*) INTO value
    FROM your_table;
    END;
    Message was edited by:
    Mark Roberts

  • How to use stored procedures in DIAdem and Can the stored procedures be used to return values?

    Can anyone please tell me how to use stored procedures in diadem and to return values from it. Its really important, can you please answer it at the earliest.
    Thanks In advance
    spiya

    Hi Spria,
    I'm very sorry for the mix-up, I thought Allen was going to answer you back with the particulars that we found out. Check out the attached Word document and the below tidbits:
    The built-in DIAdem ODBC functions {SQL_...()} can only call stored functions, which return a scaler result {found then in SQL_Result(1,1)}. The syntax for this with an ORACLE db is
    "select function(parameters) from package"
    ...where package defaults to "dual" if you don't use your own package.
    There might be exceptions to that though, and the syntax will be different for other databases. Note that stored ORACLE procedures can NOT be called from the ODBC functions, instead you must use either ADO function calls in the DIA
    dem VBScript or the OO4O COM wrapper that ORACLE provides (this is described in further detail in the below Word document).
    Hope this helps,
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments
    Attachments:
    Calling_ORACLE_Stored_Procedures_from_DIAdem.doc ‏28 KB

  • I am using Mandriva Linux now and I have installed Firefox 6 but I could not install Java plugin with it. Can anyone please help me how to install it?

    I am using Mandriva Linux now.
    But I am using Firefox 3.6.8, but I cannot install java plugin in it.
    Can anyone please help me how to install it?

    The plugins folder in the Firefox installation folder doesn't exist by default. There is no default plugin in Firefox 4, so that folder would be empty and in thus not included. If you want to use that location then you need to create a plugins folder.
    Did you try /usr/lib/mozilla/plugins ?

  • Trying to understand how pics are stored

    I'm new to Mac (iMac Core i5 27") and trying to understand how pictures are stored. I've searched and found some posts that are relevant, but I really wanted to try and confirm a couple of things that still aren't clear to me.
    First question is: Are the pictures in Events, Photos and Albums all the same photos?
    Second question: If I import pictures from my external drive into iPhoto, are they stored on the iMac hard drive in the Pictures folder, and just viewed in iPhoto?
    Thanks!

    First question is: Are the pictures in Events, Photos and Albums all the same photos?
    Yes. Iphoto works on a Library bsis. Every photo is in the Library. Events and Photos are both views of the Library. Albums reference photos in the Library. A photo can be in many Albums and use no extra disk space.
    If I import pictures from my external drive into iPhoto, are they stored on the iMac hard drive in the Pictures folder, and just viewed in iPhoto?
    Yes, by default. There are other options - for instance, iPhoto integrates with almost every app on your Mac, you can store the Library on an external etc etc. If you tell us what you'd like to achieve we may be able to help you.
    Regards
    TD

  • Subtle bug in Deitel & Deitel "Java How to Program" book

    Merry x mas and happy new year, guys.
    I have this applet (which is at the same time runnable and listener) its printed in Deitel & Deitel "Java How to Program" book 3rd ed.
    The program works but as you turn on and off the "suspend" checkboxes some of the threads are not notified, so they go to infinite wait state, deadlock. I couldn't figure out what is wrong or how to fix the problem.. please read the code below, or copy and paste this code to your eclipse, its just one file, then play with the check boxes, some of the threads don't wake up after wait... technically they don't shift from WAITING to TIMED_WAITING state.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    * @author
    // Fig. 15.7: RandomCharacters.java
    // Demonstrating the Runnableinterface
    public class RandomCharacters extends JApplet implements Runnable, ActionListener {
        private String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        private JLabel outputs[];
        private JCheckBox checkboxes[];
        private final static int SIZE = 3;
        private Thread threads[];
        private boolean suspended[];
        public void init() {
            outputs = new JLabel[SIZE];
            checkboxes = new JCheckBox[SIZE];
            threads = new Thread[SIZE];
            suspended = new boolean[SIZE];
            Container c = getContentPane();
            c.setLayout(new GridLayout(SIZE, 2, 5, 5));
            for (int i = 0; i < SIZE; i++) {
                outputs[i] = new JLabel();
                outputs.setBackground(Color.green);
    outputs[i].setOpaque(true);
    c.add(outputs[i]);
    checkboxes[i] = new JCheckBox("Suspended");
    checkboxes[i].addActionListener(this);
    c.add(checkboxes[i]);
    public void start() {
    // create threads and start every time start is called
    for (int i = 0; i < threads.length; i++) {
    threads[i] = new Thread(this, "Thread " + (i + 1));
    threads[i].start();
    public void run() {
    Thread currentThread = Thread.currentThread();
    int index = getIndex(currentThread);
    char displayChar;
    while (threads[index] == currentThread) {
    // sleep from 0 to 1 second
    try {
    Thread.sleep((int) (Math.random() * 1000));
    synchronized (this) {
    while (suspended[index]
    && threads[index] == currentThread) {
    wait();
    } catch (InterruptedException e) {
    System.err.println("sleep interrupted");
    displayChar = alphabet.charAt(
    (int) (Math.random() * 26));
    outputs[index].setText(currentThread.getName() + ": " + displayChar);
    System.err.println(currentThread.getName() + " terminating");
    private int getIndex(Thread current) {
    for (int i = 0; i < threads.length; i++) {
    if (current == threads[i]) {
    return i;
    return -1;
    public synchronized void stop() {
    // stop threads every time stop is called
    // as the user browses another Web page
    for (int i = 0; i < threads.length; i++) {
    threads[i] = null;
    notifyAll();
    public synchronized void actionPerformed(ActionEvent e) {
    for (int i = 0; i < checkboxes.length; i++) {
    if (e.getSource() == checkboxes[i]) {
    suspended[i] = !suspended[i];
    outputs[i].setBackground(
    !suspended[i] ? Color.green : Color.red);
    if (!suspended[i]) {
    notify();
    return;
    Thanks in advance.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Abiel wrote:
    No, notifyAll() is used to tell the threads that we're stopping.... see that it's written in the stop() method of the applet. Eg if the user browses away from our applet we set the array of threads to null and notify them all. So notifyAll() makes sense.Yes, it does make sense there too (!!!!!!!).
    However, I gave it a try with what u suggested, and it didn't work (as expected) .... Apparently you did not really read my suggestion or my explanation. If you had, you'd have expected it to work and it would have worked.
    the problems still remains, some threads are getting in wait state even if their check box is not suspended.Maybe you should add the following code to understand the root cause and solution.
        System.out.println("Thread " + index + " will wait to be notified.");
        wait();
        System.out.println("Thread " + index + " was notified.");
    what could the problem be?Improper use of notify()
    With kind regards
    Ben

  • How to call stored function in my jsp

    how to call stored function in my jsp?
    please give me a example.

    Hi,
    think we need mor einformation, like JDeveloper release and the how you do access the database (JDBC, BC4J, EJB,ADF...)
    Frank

Maybe you are looking for