Saturday, 23 November 2019

How to use binarySearch(long[] a, int fromIndex, int toIndex, long key) method of Arrays Class?

How to use binarySearch(long[] a, long key) method of Java.util.Arrays Class?

How to use binarySearch(int[] a, int fromIndex, int toIndex, int key) method of Arrays Class?

How to use binarySearch(int[] a, int key) method of Java.util.Arrays Class?

How to use asList(T... a) method of Java.util.Arrays Class?

How to sort the range of Employee Array? | sort - Comparator

How to sort the range of Integer Array? | sort - Comparator

How to sort the String Array content into Asc order? | sort(Object[] a) method of Arrays

How to sort the Employee Array content into Desc order based on the salary? | sort - Comparator

How to sort the Employee Array content into Asc order based on the salary? | sort - Comparator

Saturday, 16 November 2019

How to sort the Employee Array content into Asc and Desc order? | sort(Object[] a) method of Arrays

How to sort the IntegerArray in desc order using Comparator? | sort(T a, Comparator c) method Arrays

How to sort the charArray? | sort(char[] a, int fromIndex, int toIndex) method of Java.util.Arrays

How to sort the charArray? | sort(char[] a) method of Java.util.Arrays Class

How to sort the objectArray? | sort(Object[] a, int fromIndex, int toIndex) method of Arrays

How to sort the objectArray? | sort(Object[] a) method of Java.util.Arrays Class

How to sort the doubleArray? | sort(double[] a, int fromIndex, int toIndex) method of Arrays

How to sort the doubleArray? | sort(double[] a) method of Java.util.Arrays Class

How to sort the floatArray? | sort(float[] a, int fromIndex, int toIndex) method of Java.util.Arrays

How to sort the floatArray? | sort(float[] a) method of Java.util.Arrays Class

How to sort the longArray? | sort(long[] a, int fromIndex, int toIndex) method of Java.util.Arrays

How to sort the longArray? | sort(long[] a) method of Java.util.Arrays Class

How to sort the intArray? | sort(int[] a, int fromIndex, int toIndex) method of Java.util.Arrays

How to sort the intArray? | sort(int[] a) method of Java.util.Arrays Class

How to sort the shortArray? | sort(short[] a, int fromIndex, int toIndex) method Java.util.Arrays

How to sort the shortArray? | sort(short[] a) method of Java.util.Arrays Class

How to change the format in Eclipse? | Eclipse Code Formatter

Want More Java & Eclipse Guides?

Subscribe to Ram N Java for clean coding tips, IDE shortcuts, and beginner-friendly tutorials!

Subscribe Now on YouTube

Why Code Formatting Matters in Eclipse

Messy code with uneven indentation and inconsistent brace styles makes projects hard to read and debug. Well-formatted code makes your logic easier to follow and helps teams maintain a uniform coding standard.

The Eclipse IDE includes a powerful built-in code formatter that automatically arranges indentation, spacing, line wrapping, and braces with a single click or keyboard shortcut.

How to Quickly Format Your Code (Shortcut)

Before customizing profiles, you can format any open Java file immediately using the keyboard shortcut:

  • Windows / Linux: Press Ctrl + Shift + F
  • macOS: Press Cmd + Shift + F

Eclipse will instantly reorganize the entire file based on your active code style rules.

Step-by-Step Guide to Customize the Code Formatter

If you want to adjust tab sizes, brace placement, or line-wrapping limits, follow these simple steps:

  1. Open Preferences: Go to the top menu, click Window, and select Preferences (on macOS, choose Eclipse > Settings/Preferences).
  2. Navigate to Formatter: In the left navigation tree, expand Java > Code Style > Formatter.
  3. Create or Edit a Profile: Eclipse protects default profiles from direct changes. Click New... to create your own profile based on the standard Eclipse or Google style.
  4. Adjust Your Settings: Customize your preferred tab policy (tabs vs. spaces), indentation size, brace placement, blank lines, and line-wrapping rules.
  5. Apply and Save: Click OK, then click Apply and Close to activate your new formatting profile across your workspace.

Pro-Tip: Format Automatically on Save

You can configure Eclipse to clean up your code every time you save a file (Ctrl + S):

  • Go to Window > Preferences > Java > Editor > Save Actions.
  • Check Enable additional actions and tick Format source code.
  • Click Apply and Close. Now your code cleans up automatically whenever you save!

Watch More Eclipse Tutorials:

How to change the font size in eclipse? | Eclipse Setup

Want More Java & Eclipse Tips?

Subscribe to Ram N Java for quick, practical coding guides and productivity hacks!

Subscribe Now on YouTube

Why Change Font Size in Eclipse?

When you spend hours reading and writing code, eye strain can become a serious problem. The default text size in the Eclipse IDE is often too small, especially on high-resolution screens or during live presentations and tutorials.

Increasing your editor font size makes your code easier to scan, reduces eye fatigue, and helps you spot syntax errors much faster.

Step-by-Step Guide to Adjust Eclipse Font Size

You can quickly customize the code font size in Eclipse by following these simple steps:

  1. Open Preferences: Go to the top menu bar, click Window, and select Preferences (on macOS, click Eclipse > Settings/Preferences).
  2. Navigate to Appearance: In the left sidebar, expand General, then click on Appearance.
  3. Select Colors and Fonts: Under Appearance, click on Colors and Fonts.
  4. Find Text Font: In the center list, expand the Basic folder and scroll down to select Text Font.
  5. Edit Font Settings: Click the Edit... button on the right side. Choose your preferred font style, font family, and a larger size (such as 14, 16, or 18 pt).
  6. Save Changes: Click OK, then click Apply and Close to update your editor instantly.

Quick Keyboard Shortcuts for Faster Adjustments

If you need to change your font size on the fly without opening preferences every time, you can use built-in shortcuts:

  • Increase Font Size: Press Ctrl + + (Windows/Linux) or Cmd + + (Mac)
  • Decrease Font Size: Press Ctrl + - (Windows/Linux) or Cmd + - (Mac)
  • Reset to Default: Press Ctrl + 0 (Windows/Linux) or Cmd + 0 (Mac)

Watch More Eclipse Tutorials:

Tutorials