Java script programme that can work as described in the body

Rubberband lines and GUI.
For this assignment you will provide users the functionality to draw connected line segments (polylines). The initial point is specified when the user left-clicks on a blank canvas. Subsequent points are specified by moving the mouse and left-clicking. As the user moves the mouse, a temporary line is drawn from the previous point to the current mouse position. This line is continually updated (by erasing and redrawing the line) as the mouse is moved. The polyline is terminated when the user right-clicks on the canvas.
Create a blank (white) canvas at least 500 x 500 in dimension.
Recognize left and right mouse clicks. Echo the mouse positions for each mouse click (use console.log).
Maintain a list of points representing positions of mouse clicks (both left and right).
Draw lines between pairs of points.
Draw rubberband line between the last point and the current mouse position.
Print out sequence of mouse click positions when a polyline is complete (when right-click of mouse is detected). Note that it’s possile to draw multiple polylines. For this assignment, only one poyline is required.
Check out the ClickedPoints and the HelloTriangle_LINE_STRIP examples from the Matsuda-Lea book. Online resource on mouse events may also be useful.
You start off with 100 points. You earn additional credit by turning in your assignment
early and/or implementing additional features. You lose credit for missing functionality,
incorrect results, poorly documented or formatted code, or not following instructions.

Below is a partial list:

  • up to 10 points off for poor features.html file
  • up to 10 points off for inadequate comments or hard-to-read code
  • up to 10 points off for not following instructions
  • up to 10 points off for special handling to grade your homework (usually
    because you did not check that it runs on the computers in the lab first).
  • functionality points depending on importance

Make sure you:
a. submit the right files you want us to grade,
b. have tested your code on the browsers in the lab.
c. follow the general instructions described in overview.html

General Policies: All course work are intended as individual effort (unless explicitly mentioned otherwise) and are graded as such. It is okay to discuss general approaches and algorithms with other students, but this should be done without writing, looking, or sharing code. Cheating or plagiarism in any form will not be tolerated. What happens is that you will get a zero for the test or program, and the clause about having to “pass all components in order to pass the course” kicks in. Aside from academic sanctions, additional disciplinary sanctions may apply if this is not your first offense. Punishment will match severity of offense. You are responsible for protecting your solutions and programs from being copied by others. Refer to the Academic Misconduct Policy for Undergraduates. If anything is not clear, ask me.
Protecting your work: Because WebGL is run off a browser, it is important that you develop your code “offline” by pointing the browser to a local file as opposed to a url.Before you submit your work: Make sure that your program runs on the browsers in the lab. If it does not, we cannot grade them.Submitting your work: Each programming assignment should be placed in its own folder. The folder should contain at least 4 files:
features.html file,
driver.html file,
your javascript code, and
screen shot of your output.
The features.html file should contain your name, login ID, programming assignment number, date, etc. It should have a high-level description of your implementation including what was implemented, what was not, any special features, a user-guide if appropriate, etc. Finally, it should have at least one output image and a link to the driver.html file for the user (grader) to test your code. Your javascript code should have proper documentation including comment blocks for each function, and inline comments as appropriate. Code should be formatted so that it is easy for humans to read. All references in both html files should be local i.e. relative to your submit folder.You can re-submit as often as you want. We will only grade the most recent submission.Do not submit the Matsuda/Lea lib folder. Make sure that your driver.html file refer to this folder as ../lib. When we grade your submissions, there will be a lib folder that is at the same level as your submission folder.

Android Studio – Starting and Stopping a Loop With a Button Press

I’m new to using Android Studio, and am currently writing an app that makes use of sensors in the phone to control another device. I searched and haven’t found much that helps me address my issue. Eventually I need to transmit the data I get from the sensors over a network, but I’m nowhere near that point yet so that’s for another day.

Right now, the app can access the sensors and display it on the phone screen. Each time the on screen button is pressed it updates the readings. What I want it to do though is once I press the button once, continually update the values in real time as the phone is moved around. If the button is pressed again I’d like it to stop. Below is my current code in the main activity. What I tried to do was use an integer that I would toggle each time the button was pressed and run a do while loop on one of the values. When the do while loop is in there it won’t do anything. If I take it out, it runs like it originally did updating the values each time the button is pressed. I also am displaying the value of “toggle” next to the sensor values and it is toggling when the do while loop isn’t in there. I don’t understand why the do while loop won’t run at all. I also tried using a boolean value and toggling between true and false but I got the same result. I also realize that the way the do while loop is set up it would probably not be able to be stopped, but I would’ve thought it would’ve at least entered the loop and kept running which would’ve at least got me started.

    import android.os.Bundle;
    import android.hardware.Sensor;
    import android.hardware.SensorEvent;
    import android.hardware.SensorEventListener;
    import android.hardware.SensorManager;
    import android.widget.TextView;
    import android.widget.Button;
    import android.view.View;

    public class MainActivity extends AppCompatActivity

int toggle = 0;
public void onCreate(Bundle savedInstanceState) {

    SensorManager sensorManager = (SensorManager) this.getSystemService(SENSOR_SERVICE);

    final float[] mValuesMagnet = new float[3];
    final float[] mValuesAccel = new float[3];
    final float[] mValuesOrientation = new float[3];
    final float[] mRotationMatrix = new float[9];

    final Button btn_valider = (Button) findViewById(;
    final TextView txt1 = (TextView) findViewById(;
    final SensorEventListener mEventListener = new SensorEventListener() {
        public void onAccuracyChanged(Sensor sensor, int accuracy) {

        public void onSensorChanged(SensorEvent event) {
            switch (event.sensor.getType()) {
                case Sensor.TYPE_ACCELEROMETER:
                    System.arraycopy(event.values, 0, mValuesAccel, 0, 3);

                case Sensor.TYPE_MAGNETIC_FIELD:
                    System.arraycopy(event.values, 0, mValuesMagnet, 0, 3);


    setListners(sensorManager, mEventListener);

    btn_valider.setOnClickListener(new View.OnClickListener()

        public void onClick(View view)
            if(toggle == 0)
                toggle = 1;
            else if(toggle == 1)
                toggle = 0;


                SensorManager.getRotationMatrix(mRotationMatrix, null, mValuesAccel, mValuesMagnet);
                SensorManager.getOrientation(mRotationMatrix, mValuesOrientation);

                final CharSequence test;
                test = "Roll/Pitch (degrees): " + /*mValuesOrientation[0]*(180/Math.PI) + " "+ "," + " " +*/
                        mValuesOrientation[1] * (180 / Math.PI) + " " + "/" + " " +
                        mValuesOrientation[2] * (-180 / Math.PI) + " " + "Toggle = " + toggle;

            }while(toggle == 1);



public void setListners(SensorManager sensorManager, SensorEventListener mEventListener)
    sensorManager.registerListener(mEventListener, sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),
    sensorManager.registerListener(mEventListener, sensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD),


Why does a thread test a condition/property while holding the lock rather than before acquiring the lock?

From The Arts of Multiprocessing Programming by Herlihy:

Suppose a thread
wants to wait until a certain property holds. The thread tests the property while
holding the lock.
If the property does not hold, then the thread calls await() to
release the lock and sleep until it is awakened by another thread.

1 Condition condition = mutex.newCondition();
2 ...
3 mutex.lock()
4 try {
5     while (!property) { // not happy
6         condition.await(); // wait for property
7     } catch (InterruptedException e) {
8         ... // application-dependent response
9     }
10    ... // happy: property must hold
11 }

Figure 8.2 How to use Condition objects.

Why does the thread call mutex.lock() before it tests the property (if the property doesn’t hold, the thread calls await()) rather than after?



MY test has an error in line 97 I it should be that I don’t know how to give to mock the right value to process from my controller

 @RequestMapping(value = "/remove", method = RequestMethod.POST)
    public String remove(
            @ModelAttribute( "id" ) String id, Model model
    ) {
        List<Book> bookList = bookService.findAll();
        model.addAttribute("bookList", bookList);

        return "redirect:/book/bookList";

The method remove one with id substring 8, how can I represent this in my test.
Specific error is written below

    BookService bookService;  // will be inject to BookController

    MockMvc mockMvc;

    public void setUp() throws Exception {
        new BookController(bookService);
        mockMvc = standaloneSetup(controller)
                .setSingleView(new InternalResourceView("/book/bookList"))

    public void bookRemoveTest() throws Exception {
        securityService.autologin("admin", "admin");
        Book book = new Book();
        BookService bookService = mock(BookService.class);
        bookService.removeOne( book.getId());
        MvcResult result = mockMvc



org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.StringIndexOutOfBoundsException: String index out of range: -8

    at org.springframework.web.servlet.FrameworkServlet.processRequest(
    at org.springframework.web.servlet.FrameworkServlet.doPost(
    at javax.servlet.http.HttpServlet.service(
    at org.springframework.web.servlet.FrameworkServlet.service(
    at org.springframework.test.web.servlet.TestDispatcherServlet.service(
    at javax.servlet.http.HttpServlet.service(
    at org.springframework.mock.web.MockFilterChain$ServletFilterProxy.doFilter(
    at org.springframework.mock.web.MockFilterChain.doFilter(
    at org.springframework.test.web.servlet.MockMvc.perform(
    at com.admintest.controller.BookControllerTest.bookRemoveTest(
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at java.lang.reflect.Method.invoke(
    at  .evaluate(

empty output generated after mapreduce

17/10/09 05:08:28 INFO input.FileInputFormat: Total input paths to process : 1
17/10/09 05:08:28 INFO util.NativeCodeLoader: Loaded the native-hadoop library
17/10/09 05:08:28 WARN snappy.LoadSnappy: Snappy native library not loaded
17/10/09 05:08:29 INFO mapred.JobClient: Running job: job_201710090351_0005
17/10/09 05:08:30 INFO mapred.JobClient:  map 0% reduce 0%
17/10/09 05:08:33 INFO mapred.JobClient:  map 100% reduce 0%
17/10/09 05:08:40 INFO mapred.JobClient:  map 100% reduce 33%
17/10/09 05:08:42 INFO mapred.JobClient:  map 100% reduce 100%
17/10/09 05:08:42 INFO mapred.JobClient: Job complete: job_201710090351_0005
17/10/09 05:08:42 INFO mapred.JobClient: Counters: 28
17/10/09 05:08:42 INFO mapred.JobClient:   Map-Reduce Framework
17/10/09 05:08:42 INFO mapred.JobClient:     Spilled Records=0
17/10/09 05:08:42 INFO mapred.JobClient:     Map output materialized bytes=6
17/10/09 05:08:42 INFO mapred.JobClient:     Reduce input records=0
17/10/09 05:08:42 INFO mapred.JobClient:     Virtual memory (bytes) snapshot=3778531328
17/10/09 05:08:42 INFO mapred.JobClient:     Map input records=26981
17/10/09 05:08:42 INFO mapred.JobClient:     SPLIT_RAW_BYTES=111
17/10/09 05:08:42 INFO mapred.JobClient:     Map output bytes=0
17/10/09 05:08:42 INFO mapred.JobClient:     Reduce shuffle bytes=6
17/10/09 05:08:42 INFO mapred.JobClient:     Physical memory (bytes) snapshot=326467584
17/10/09 05:08:42 INFO mapred.JobClient:     Reduce input groups=0
17/10/09 05:08:42 INFO mapred.JobClient:     Combine output records=0
17/10/09 05:08:42 INFO mapred.JobClient:     Reduce output records=0
17/10/09 05:08:42 INFO mapred.JobClient:     Map output records=0
17/10/09 05:08:42 INFO mapred.JobClient:     Combine input records=0
17/10/09 05:08:42 INFO mapred.JobClient:     CPU time spent (ms)=1530
17/10/09 05:08:42 INFO mapred.JobClient:     Total committed heap usage (bytes)=302514176
17/10/09 05:08:42 INFO mapred.JobClient:   File Input Format Counters 
17/10/09 05:08:42 INFO mapred.JobClient:     Bytes Read=3027487
17/10/09 05:08:42 INFO mapred.JobClient:   FileSystemCounters
17/10/09 05:08:42 INFO mapred.JobClient:     HDFS_BYTES_READ=3027598
17/10/09 05:08:42 INFO mapred.JobClient:     FILE_BYTES_WRITTEN=110248
17/10/09 05:08:42 INFO mapred.JobClient:     FILE_BYTES_READ=6
17/10/09 05:08:42 INFO mapred.JobClient:   Job Counters 
17/10/09 05:08:42 INFO mapred.JobClient:     Launched map tasks=1
17/10/09 05:08:42 INFO mapred.JobClient:     Launched reduce tasks=1
17/10/09 05:08:42 INFO mapred.JobClient:     SLOTS_MILLIS_REDUCES=8244
17/10/09 05:08:42 INFO mapred.JobClient:     Total time spent by all reduces waiting after reserving slots (ms)=0
17/10/09 05:08:42 INFO mapred.JobClient:     SLOTS_MILLIS_MAPS=2775
17/10/09 05:08:42 INFO mapred.JobClient:     Total time spent by all maps waiting after reserving slots (ms)=0
17/10/09 05:08:42 INFO mapred.JobClient:     Data-local map tasks=1
17/10/09 05:08:42 INFO mapred.JobClient:   File Output Format Counters 
17/10/09 05:08:42 INFO mapred.JobClient:     Bytes Written=0

This shows the logs of the mapreduce job done. Below is the java code. part-r-00000 and the success file in hdfs are of 0 kb.

package bd;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map.Entry;
import java.util.TreeMap;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.Mapper.Context;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.util.GenericOptionsParser;

    public class TopTenRatedBusiness {

         * Mapper Class : BusinessRatingMapper
         * Class BusinessRatingMapper parses review.csv file and emits business id and respective rating
        public static class BusinessRatingMapper extends Mapper<LongWritable, Text, Text, FloatWritable> {
             * Map function that emits a business ID as a key and rating as a value
            protected void map(LongWritable key, Text value, Context context)throws IOException, InterruptedException {

                String reviews[] = value.toString().split("::");
                                if (reviews.length < 4)

                 * reviews[2] gives business id and reviews[3] gives business rating
                context.write(new Text(reviews[2]), new FloatWritable(Float.parseFloat(reviews[3])));


         * Reducer class: TopRatedBusinessReducer
         * Class TopRatedBusinessReducer emits top 10 business id with their average rating
        static TreeMap<Float, List<Text>> reviewID = new TreeMap<Float, List<Text>>(Collections.reverseOrder());

        public static class BusinessRatingReducer extends Reducer<Text, FloatWritable, Text, FloatWritable> {

             * Reduce function
            public void reduce(Text key, Iterable<FloatWritable> values, Context context)throws IOException, InterruptedException {
                float sumOfRatings =  0;
                int countOfRatings = 0;
                for (FloatWritable value : values) {
                    sumOfRatings += value.get();

                Float averageRating = sumOfRatings / countOfRatings;

                if (reviewID.containsKey(averageRating)) {
                    reviewID.get(averageRating).add(new Text(key.toString()));
                } else {
                    List<Text> businessIDList = new ArrayList<Text>();
                    businessIDList.add(new Text(key.toString()));

                     * Putting average rating and corresponding business ID
                    reviewID.put(averageRating, businessIDList);

            protected void cleanup(Reducer<Text, FloatWritable, Text, FloatWritable>.Context context)throws IOException, InterruptedException {

                int count=0;
                for(Entry<Float, List<Text>> entry : reviewID.entrySet()) {
                    if(count > 10){

                 FloatWritable result=new FloatWritable();

                 for (int i = 0; i <entry.getValue().size(); i++) {
                      if (count >= 10) {
                       context.write(new Text(entry.getValue().get(i).toString()), result);



             * Driver Program

            public static void main(String[] args) throws IOException,ClassNotFoundException, InterruptedException, NoSuchMethodException {

                Configuration conf = new Configuration();
                String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs();
                if (otherArgs.length != 2) {
                    System.err.println("Usage: TopTenRatedBusiness <in> <out>");

                 * Create a job with name "TopTenRatedBusiness"

                Job job = new Job(conf, "TopTenRatedBusiness");



                FileInputFormat.addInputPath(job, new Path(otherArgs[0]));
                FileOutputFormat.setOutputPath(job, new Path(otherArgs[1]));
                System.exit(job.waitForCompletion(true) ? 0 : 1);



how do I generate a csv file as the output?

hadoop jar ‘/home/hduser/Downloads/Hadoop/TopTenRatedBusiness.jar’ bd.TopTenRatedBusiness /Yelp/input/business.csv /Yelp/output.csv/

I used this command to generate the output.
Thanks in advance 🙂

The right way to merge all the bytes into one when it comes to packet, stuck on this part

My code is a data structure that the input of text files (packets), then merge and recover them.

But the logic behind my code is not right, I want try to combine ALL of the bytes into a single bytes, rather than combining pairs of bytes. It also looks like I’m not handling the packets separately.

I need to input pairs of bytes or pairs of packets and then combine those pairs.

So if my input is two packets that look like this:

{A, B, C, D}
{E, F, G, H}

The combined packet would be:

{A+E, B+F, C+G, D+H}

Then, I’d take that combined packet and restore it with the first original packet to recover {E, F, G, H} or restore it with the second original packet to recover {A, B, C, D}.

This is my current code:

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        List<Packet> packets = readPackets("file1.txt");


        Packet jumbo = PacketUtils.combine(packets);

        System.out.printf("combined: %s%n", jumbo);

        Packet p1 = packets.remove(0); // just remove first packet

        System.out.printf("first packet: %s%n", p1);

        // Lets try to restore removed packet from combined packet and all other single packets

        Packet p1restored = PacketUtils.restore(jumbo, packets);

        System.out.printf("restored: %s%n", p1restored);

    public static List<Packet> readPackets(String ...files) throws Exception {
        List<Packet> packets = new ArrayList<>();

        for (String file: files) {
            Scanner scanner = new Scanner(new FileInputStream(file));

            while (scanner.hasNextLine()) {
                final String line = scanner.nextLine().trim();

                if (!line.startsWith("|0 ")) {

                List<Packet> packetList = Stream.of(line.split("\|"))
                        .filter(s -> s.matches("^(?i)[0-9a-f]{2}$"))
                        .map(s -> Integer.parseInt(s, 16))


        return packets;

class Packet {
    private int value;

    Packet(int value) {
        this.value = value;

    int getValue() {
        return value;

    public String toString() {
        return "Packet{" +
                "value=" + value +

class PacketUtils {

    public static Packet combine(Stream<Packet> packets) {
        int combinedValue =;
        return new Packet(combinedValue);

    public static Packet combine(Collection<Packet> packets) {
        return combine(;

    public static Packet restore(Packet jumbo, Collection<Packet> allButOneSinglePacketsInJumbo) {
        int value = restore(jumbo.getValue(), combine(allButOneSinglePacketsInJumbo).getValue());
        return new Packet(value);

    private static int combine(int a, int b) {
        return a ^ b;

    private static int restore(int xor, int b) {
        return xor ^ b;

The right logic should I be something like this, how should I change my methods?

public class PacketsFun {

  static byte[] combine(byte[] p1, byte[] p2) {
    if (p1.length != p2.length) throw new RuntimeException();
    byte[] combined = new byte[p1.length];
    for (int i = 0; i < p1.length; i++) {
      combined[i] = (byte) (p1[i] ^ p2[i]);
    return combined;

  static byte[] recover(byte[] combined, byte[] p) {
    // turns out that with xor, combine and recover are the same function!
    return combine(combined, p);

  static String toString(byte[] p) {
    StringBuilder sb = new StringBuilder();
    sb.append("{ ");
    for (int i = 0; i < p.length; i++) {
      if (i > 0) sb.append(", ");
    sb.append(" }");
    return sb.toString();

  public static void main(String[] args) {
    byte[] p1 = new byte[] { 19, 23, 47, 15, 21 };
    byte[] p2 = new byte[] { 22, 13, 71, 33, 45 };

    byte[] combined = combine(p1, p2);

    byte[] recoverP1 = recover(combined, p2);
    byte[] recoverP2 = recover(combined, p1);

    System.out.println("       p1: " + toString(p1));
    System.out.println("       p2: " + toString(p2));
    System.out.println(" combined: " + toString(combined));
    System.out.println("recoverP1: " + toString(recoverP1));
    System.out.println("recoverP2: " + toString(recoverP2));


This is my input text file for example:

15:05:02,765,660 ETHER
|0 |01|00|5e|00|00|fb|0a|00|27|00|00|09|08|00|45|00|00|6c|4c|de|00|00|ff|11|94|fd|c0|a8|38|01|e0|00|00|fb|14|e9|14|e9|00|58|d0|74|00|00|00|00|00|01|00|00|00|01|00|00|0a|44|41|43|48|45|4e|4d|43|49|53|09|5f|72|70|2d|6d|65|64|69|61|04|5f|74|63|70|05|6c|6f|63|61|6c|00|00|ff|00|01|c0|0c|00|21|00|01|00|00|00|78|00|13|00|00|00|00|4e|99|0a|64|61|63|68|65|6e|6d|63|69|73|c0|26|

15:05:03,021,433 ETHER
|0 |01|00|5e|00|00|fb|0a|00|27|00|00|09|08|00|45|00|00|6c|4c|df|00|00|ff|11|94|fc|c0|a8|38|01|e0|00|00|fb|14|e9|14|e9|00|58|d0|74|00|00|00|00|00|01|00|00|00|01|00|00|0a|44|41|43|48|45|4e|4d|43|49|53|09|5f|72|70|2d|6d|65|64|69|61|04|5f|74|63|70|05|6c|6f|63|61|6c|00|00|ff|00|01|c0|0c|00|21|00|01|00|00|00|78|00|13|00|00|00|00|4e|99|0a|64|61|63|68|65|6e|6d|63|69|73|c0|26|

15:05:03,270,306 ETHER
|0 |01|00|5e|00|00|fb|0a|00|27|00|00|09|08|00|45|00|00|6c|4c|e0|00|00|ff|11|94|fb|c0|a8|38|01|e0|00|00|fb|14|e9|14|e9|00|58|d0|74|00|00|00|00|00|01|00|00|00|01|00|00|0a|44|41|43|48|45|4e|4d|43|49|53|09|5f|72|70|2d|6d|65|64|69|61|04|5f|74|63|70|05|6c|6f|63|61|6c|00|00|ff|00|01|c0|0c|00|21|00|01|00|00|00|78|00|13|00|00|00|00|4e|99|0a|64|61|63|68|65|6e|6d|63|69|73|c0|26|

15:05:03,521,293 ETHER
|0 |01|00|5e|00|00|fb|0a|00|27|00|00|09|08|00|45|00|00|fb|4c|e1|00|00|ff|11|94|6b|c0|a8|38|01|e0|00|00|fb|14|e9|14|e9|00|e7|87|4e|00|00|84|00|00|00|00|04|00|00|00|04|0a|44|41|43|48|45|4e|4d|43|49|53|09|5f|72|70|2d|6d|65|64|69|61|04|5f|74|63|70|05|6c|6f|63|61|6c|00|00|10|80|01|00|00|11|94|00|01|00|09|5f|73|65|72|76|69|63|65|73|07|5f|64|6e|73|2d|73|64|04|5f|75|64|70|c0|26|00|0c|00|01|00|00|11|94|00|02|c0|17|c0|17|00|0c|00|01|00|00|11|94|00|02|c0|0c|c0|0c|00|21|80|01|00|00|00|78|00|13|00|00|00|00|4e|99|0a|64|61|63|68|65|6e|6d|63|69|73|c0|26|c0|7d|00|01|80|01|00|00|00|78|00|04|c0|a8|38|01|c0|7d|00|1c|80|01|00|00|00|78|00|10|fe|80|00|00|00|00|00|00|01|bd|73|12|3c|94|3b|45|c0|7d|00|2f|80|01|00|00|00|78|00|08|c0|7d|00|04|40|00|00|08|c0|0c|00|2f|80|01|00|00|11|94|00|09|c0|0c|00|05|00|00|80|00|40|

15:05:04,521,093 ETHER
|0 |01|00|5e|00|00|fb|0a|00|27|00|00|09|08|00|45|00|00|fb|4c|e2|00|00|ff|11|94|6a|c0|a8|38|01|e0|00|00|fb|14|e9|14|e9|00|e7|87|4e|00|00|84|00|00|00|00|04|00|00|00|04|0a|44|41|43|48|45|4e|4d|43|49|53|09|5f|72|70|2d|6d|65|64|69|61|04|5f|74|63|70|05|6c|6f|63|61|6c|00|00|10|80|01|00|00|11|94|00|01|00|09|5f|73|65|72|76|69|63|65|73|07|5f|64|6e|73|2d|73|64|04|5f|75|64|70|c0|26|00|0c|00|01|00|00|11|94|00|02|c0|17|c0|17|00|0c|00|01|00|00|11|94|00|02|c0|0c|c0|0c|00|21|80|01|00|00|00|78|00|13|00|00|00|00|4e|99|0a|64|61|63|68|65|6e|6d|63|69|73|c0|26|c0|7d|00|01|80|01|00|00|00|78|00|04|c0|a8|38|01|c0|7d|00|1c|80|01|00|00|00|78|00|10|fe|80|00|00|00|00|00|00|01|bd|73|12|3c|94|3b|45|c0|7d|00|2f|80|01|00|00|00|78|00|08|c0|7d|00|04|40|00|00|08|c0|0c|00|2f|80|01|00|00|11|94|00|09|c0|0c|00|05|00|00|80|00|40|

I am trying to make three dice roll simultaneously until they land on the number 6

My program is supposed to print the number of rolls before all three dice come up all sixes.

This is what I have so far, but I am getting outputs that are small numbers like 1 I do not think it can take 1 time to roll all three sixes. I am expecting larger numbers.

Random rand = new Random();
    int numOfRolls = 0; //starts at zero for the number of rolls
    int x;
    int y;
    int z;
    do {
      x = rand.nextInt(6) + 1;
      y = rand.nextInt(6) + 1;
      z = rand.nextInt(6) + 1;
    } while (x == 6 || y == 6 || z == 6);

how to connect h2 database using netbeans

I am following a tutorial in youtube and some pdf reports about h2 database.. most of the tips are pointing the same process on how to connect h2 database to a java program.. As I applied the process using the tutorials carefully, I got different results. When I tried to run a test in my h2 database connection, it will appear an error.. the database already exist. possible solution is to close other databases.

I don’t know how to address or solve this one. If ever someone out there knows how to fix this, please share.