A boolean value is obtained by comparing a locally stored value with the obtained value. The current boolean Value

Source: Internet
Author: User

A boolean value is obtained by comparing a locally stored value with the obtained value. The current boolean Value
/**
* Sets the port of the local Socks5 proxy. Default is 7777. If you set the port to a negative
* Value Smack tries the absolute value and all following until it finds an open port.
*
* @ Param localSocks5ProxyPort the port of the local Socks5 proxy to set
*/
Public static void setLocalSocks5ProxyPort (int localSocks5ProxyPort ){
SmackConfiguration. localSocks5ProxyPort = localSocks5ProxyPort;
}
In JAVA, how does one convert byte to a boolean array of 8 characters (each bit represents a boolean value)

Fast Solution

Import java. util. Arrays;

Public class ByteToBooleanArray {
/**
* Convert byte to a boolean array of 8 characters (each bit represents a boolean value)
*
* @ Param B byte
* @ Return boolean Array
*/
Public static boolean [] getBooleanArray (byte B ){
Boolean [] array = new boolean [8];
For (int I = 7; I> = 0; I --) {// determine each bit of a byte
Array [I] = (B & 1) = 1; // determines whether the last byte is 1. If it is 1, it is true; otherwise, it is false.
B = (byte) (B> 1); // shift byte to the right
}
Return array;
}

Public static void main (String [] args ){
Byte B = 0x35; // 0011 0101
System. out. println (Arrays. toString (getBooleanArray (B )));
}
}

How to store information locally in as 30

What I said upstairs is to store the data in the Cook, and the cook will be cleared.

At present, flash is widely used in various aspects. flash not only focuses on its own brilliant effects, but also needs to exchange data with external programs to achieve more powerful functions, with the arrival of as3, the flash and external interaction methods become more and more convenient and rational. Today, let's talk about the interaction between as3 and backend data (the as3 + php architecture is selected here, and other configurations are the same ).

In as3, the original loadVars method has been deprecated. Instead, a series of classes are used to interact with background data. These classes are: URLLoader, URLLoaderDataFormat, URLStream, and URLVariables.
Similar to the original loadVars, The URLLoader class is a powerful tool for loading text, binary data, xml, URL data, and other information. URLLoader accepts a URLRequest as the constructed parameter and uses the load method to load data. Urloder can also listen, which is different from loadVars. A simple example is as follows:
1. // actionscript code
2. var loader: URLLoader = new URLLoader ();
3. // declare a URLRequest
4. var url: URLRequest = new URLRequest ("test. php ");
5. // set the transmission mode to POST.
6. url. method = URLRequestMethod. POST;
7. // declare a URLVariables
8. var values: URLVariables = new URLVariables ();
9. // set the information to be transmitted
10. values. message = "hello im flash !";
11. url. data = values;
12. // set the data to be parsed Using Variable-value pairs
13. loader. dataFormat = URLLoaderDataFormat. VARIABLES;
14. loader. addEventListener (Event. COMPLETE, loaded );
15. function loaded (e: Event ){
16. trace (loader. data );
17. // outPut: phpMessage = im php message! & FlashMessage = hello im flash!
18. trace (loader. data. phpMessage );
19. // im php message!
20. trace (loader. data. flashMessage );
21. // hello im flash!
22 .}
23. loader. load (url );

1. // test. php code //
2. 3. $ flashData = $ _ POST ['message'];
4. $ phpMessage = 'im php message! ';
5. echo "phpMessage = $ phpMessage & flashMessage = $ flashData ";
6.?>

The above is the basic content for interaction between as3 and the background. Now you can create such interaction in as3 to Obtain Dynamic Data to enrich your program, start on your own ...... remaining full text>
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.